hdu 5738
来源:互联网 发布:眼睛很亮女孩子知乎 编辑:程序博客网 时间:2024/06/09 20:11
#include <cmath>#include <cstdio>#include <cstring>#include <algorithm>#include <math.h>#include <iostream>#define ll long long#define mod 1000000007using namespace std;int n,maxx;double s[10005];struct line{ ll x,y;} a[10005];bool cmp(line a,line b){ return a.x<b.x;}ll pw[10100];void init(){ pw[0]=1; for (int i=1;i<=10000;i++) pw[i]=2*pw[i-1] % mod;}int main(){ long long res; int T; init(); scanf("%d",&T); while(T--) { scanf("%d",&n); res=0; for(int i=1; i<=n; i++) scanf("%lld%lld",&a[i].x,&a[i].y); sort(a+1,a+1+n,cmp); for(int i=1; i<n; i++) { int tot=1,ans=0; int c=0; for(int j=i+1; j<=n; j++) { if (a[i].x==a[j].x && a[i].y == a[j].y) c++; else { if (a[i].x==a[j].x) s[tot++]=1e9+7; else s[tot++]=(1.0*a[j].y-1.0*a[i].y)/(1.0*a[j].x-1.0*a[i].x); } } ll cnum=0; sort(s+1,s+tot); for(int i=1; i<tot-1; i++) if(fabs(s[i+1]-s[i])<1e-12) ans++; else { //res+= (1LL<<(ans+1+c)) -1; res+= pw[ans+1+c] -1 + mod ; res%=mod; ans=0; cnum++; } if (tot>1) { //res+= (1LL<<(ans+1+c)) -1; res+= pw[ans+1+c] -1 + mod ; res%=mod; cnum++; res-=(cnum-1)*(pw[c] -1 ); res%=mod; } if (tot==1) { //res+= (1LL<<c) -1 ; res+=pw[c] - 1 + mod ; res %= mod; } } printf("%lld\n",res); } return 0;}
0 0
- hdu 5738
- 【hdu 5738】Eureka
- 2016多校&&HDU.5738
- HDU 5738 Eureka
- HDU 5738 Eureka
- hdu 5738(扫描线)
- HDU 5738 Eureka
- hdu
- hdu
- HDU
- hdu ()
- hdu
- hdu
- HDU
- HDU
- hdu
- hdu
- HDU
- hdu 5755
- 历届试题 网络寻路 (树上dfs)
- java中方法的形参产生的是对象的副本
- Linux目录文件权限与ACM时间
- 文件过滤器的使用
- hdu 5738
- 在Android中使用java代码中的gayout_gravity和gravity这两个属性。
- wince窗体假死
- Vue 路由嵌套、数据请求、组件
- 通过js判断浏览器的版本
- 安卓复习梳理
- hdu 5651
- Bootstrap3.3.7全面解读和Bootstrap4.0变化分析----------004(4.0变化分析)
- hdu 5583