传送门
Professor Zhang draws n points on the plane, which are conveniently labeled by 1,2,...,n. The i-th point is at (xi,yi). Professor Zhang wants to know the number of best sets. As the value could be very large, print it modulo 109+7.
A set P (P contains the label of the points) is called best set if and only if there are at least one best pair in P. Two numbers u and v (u,v∈P,u≠v) are called best pair, if for every w∈P, f(u,v)≥g(u,v,w), where f(u,v)=(xu−xv)2+(yu−yv)2−−−−−−−−−−−−−−−−−−√ and g(u,v,w)=f(u,v)+f(v,w)+f(w,u)2.
There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. For each test case:
The first line contains an integer n (1≤n≤1000) -- then number of points.
Each of the following n lines contains two integers xi and yi (−109≤xi,yi≤109) -- coordinates of the i-th point.
题意:
满足题意的点集为共线点集和相同点集,一个集合至少两个点;
额上面是搜到的题意,其实就是问任意多个在一条直线上点,构成一个集合。问集合数多少。例如,同一条直线有三个点,a,b,c。ab,bc,ac,abc共有四个点集合,这里有方向。
因为有方向,要排个序。因为有相同点的存在,求出相同点多少个,然后从相同点抽取i个点,2^i个,乘上其他在这条直线上的点个数的2^k个。自己单独集合单算。具体公式:(2 m −1−m)+sum((s m −1)∗(2 k −1)) 。公式摘自http://blog.csdn.net/lhfl911/article/details/52004755。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include