题意:统计平面内有多少个点共线,有重点
思路:显然没有重点的时候是个水题,这里统计共线我是用了斜率存进map里面,由于直接除会是double很容易挂,所以直接map<pair<>,int>这样来处理就可以解决了,然后算一下重点的贡献和不重点的贡献就可以了
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define LL long long
#define N 1005
#define mod 1000000007
#define INF 0x3f3f3f3f
map<pii, int> mp;
pii p[N];
template <class T> inline void in(T &x)
{T f = 1;char c;while ((c = getchar()) < '0' || c > '9') if (c == '-') f = -1;x = c - '0';while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0';x *= f;
}
LL quickpow(LL m, LL n) //返回m^n%k
{LL b = 1;while (n > 0){if (n & 1)b = (b * m) % mod;n = n >> 1 ;m = (m * m) % mod;}return b;
}
void solve()
{int n;in(n);for(int i=1; i<=n; i++) in(p[i].first),in(p[i].second);LL ans=0;for(int i=1; i<=n; i++){mp.clear();LL res=1;for(int j=i+1; j<=n; j++){if(p[j].first==p[i].first&&p[j].second==p[i].second){res++;continue;}int dy=p[j].second-p[i].second;int dx=p[j].first-p[i].first;int gcd=__gcd(dy, dx);if(gcd!=0){dy/=gcd;dx/=gcd;}mp[pii(dy,dx)]++;}if(res>=2) ans=(ans+quickpow(2,res-1)-1)%mod;for(auto it=mp.begin(); it!=mp.end(); it++)ans=(ans+((quickpow(2, it->second)-1)*quickpow(2, res-1))%mod)%mod;}cout << ans << endl;
}
int main()
{int t;in(t);while(t--){solve();}return 0;
}