题目传送门 传送点I 传送点II 传送点III 题目大意 给定$n$的平面上的直线,保证没有三条直线共点,两条直线平行.问随机选出3条直线交成的三角形面积的期望. 显然$S=\frac{1}{2}ah$是不可用的.(压根感觉不可优化) 考虑向量的做法:$S = \frac{1}{2}(A \times B + B \times C + C\times A)$.(相当于把一个三角形拆成了三个以原点作为其中一个顶点的"有向"三角形) 于是考虑利用向量叉积对向量加法的分配律进行优化. 枚举第…
[CF528E]Triangles 3000(计算几何) 题面 CF 平面上有若干条直线,保证不平行,不会三线共点. 求任选三条直线出来围出的三角形的面积的期望. 题解 如果一定考虑直接计算这个三角形的面积,我们很难不去弄出这三个交点. 我们需要的是低于\(O(n^3)\)的复杂度,而\(O(n^3)\)的做法可以直接暴力枚举三条直线. 考虑向量计算面积的方法,对于一个在三角形\(\Delta ABC\)之外的点\(O\),我们可以有: \[S\Delta ABC=\frac{1}{2}(OA\…
Codeforces 15E Triangles Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by t…
Alyona and Triangles 题目连接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/J Description You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n point…
http://codeforces.com/contest/528/problem/E 先来吐槽一下,一直没机会进div 1, 马力不如当年, 这场题目都不是非常难,div 2 四道题都是水题! 题目大意:给n条直线,保证直线两两不平行,保证三条直线不公点.然后,随机挑三条直线,构成一个三角形,问挑出的三角形的面积的期望. 换句话说,就是算出全部三角形的面积和.再除以三角形的数量.后者是C(n,3), 关键是三角形面积和怎样计算. 下面给我我的思路:O(n^2) 基于三角形的向量表示法, S(A…
Last summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not by the fear of the wolf, but…
Description   Problem B: Myacm Triangles Problem B: Myacm Triangles Source file: triangle.{c, cpp, java, pas} Input file: triangle.in Output file: triangle.out There has been considerable archeological work on the ancient Myacm culture. Many artifact…
cf luogu 既然要求三角形面积,不如考虑三角形的面积公式.因为是三条直线,所以可以考虑利用三个交点来算面积,如果这个三角形按照逆时针方向有\(ABC\)三点,那么他的面积为\(\frac{\vec{OA}*\vec{OB}+\vec{OB}*\vec{OC}+\vec{OC}*\vec{OA}}{2}\),其实也就是一个大三角形减去两个小三角形,得到的就是要求的三角形 所以可以先枚举一条直线,注意到三角形面积是可以枚举算贡献的,所以只要求出所有在这条直线上的边的贡献就行了.把这条直线当做\…
ShitáliaTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88994#problem/A Description After suddenly becoming a billionaire, Shi adopted YOLO as his motto and decided to buy a small european island, wh…
Problem A. AerodynamicsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86821#problem/A Description Bill is working in a secret laboratory. He is developing missiles for national security projects. Bi…