题意: 给出平面上n个点,问能在其中选出6个点,组成两个三角形,使得其互不相交 问有多少种选法 大致思路 考虑枚举一条直线,将所有得点分为左右两部分,其中有两个点在直线上, 以这两个点为顶点,分别统计左边有多少个三角形,右边有多少个三角形即可. 枚举直线时,枚举一个点,然后对其他点极角排序, 枚举另一个点,可快速算出该直线左右两边的点的数量(二分,叉积),组合一下即可. /* : . : i i . i : . i . i . i : . i . i i : . . . . . . . ..…
A point belongs to a triangle if it lies inside the triangle or on one of its sides. Two triangles are disjoint if there is no point on the plane that belongs to both triangles. You are given nn points on the plane. No two points coincide and no thre…
Codeforces Codeforces Round #484 (Div. 2) D. Shark 题目连接: http://codeforces.com/contest/982/problem/D Description For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and…
Codeforces Codeforces Round #484 (Div. 2) E. Billiard 题目连接: http://codeforces.com/contest/982/problem/E Description Consider a billiard table of rectangular size $n \times m$ with four pockets. Let's introduce a coordinate system with the origin at t…
Codeforces Global Round 2 题目链接: E. Pavel and Triangles Pavel has several sticks with lengths equal to powers of two. He has \(a_0\) sticks of length \(2^0=1\), \(a1\) sticks of length \(2^1=2\), ..., \(a_{n−1}\) sticks of length \(2^{n−1}\). Pavel wa…
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…
传送门:C - Count Triangles 题意:给你四个数A,B,C,D,求有多少个三边为x,y,z (A ≤ x ≤ B ≤ y ≤ C ≤ z ≤ D)的三角形. 题解:枚举 x=A~B,然后计算当z的值大于等于C时,y为最小值B可以有多少个三角形,y为最大值C有多少个三角形.想想就可以发现 y=B~C时 其实就是一个差值为1的等差数列.然后要算出 y=B 和 y=C 时 z 比最大值D大了多少,这也是个等差数列,然后两个等差数列做差就好了.这么说可能有点乱,代码看了就明白了. 1…
C. Replacement Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/570/problem/C Description Daniel has a string s, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replac…
C. ReplacementTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/570/problem/C Description Daniel has a string s, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replace…