Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
RE了好多次不知道怎么回事就过了,141MS#include<cstdio> #include<iostream> #include<algorithm> #include<fstream> #define N 701 double a[N] = {0}; using namespace std; struct mypoint { int x; int y; }; int cmp(mypoint a,mypoint b) { return (a.x==b.x && a.y<b.y || a.x <b.x); } mypoint aa[701]; int main() { freopen("D:\\in.txt","r",stdin); int i = 0; int n; while(scanf("%d",&n) && n) { int num = 0; for(int i = 0;i<n;i++) { cin>>aa[i].x>>aa[i].y; } sort(aa,aa+n,cmp); int max = 0; for(int i = 0;i<n;i++) { for(int j = i+1;j<n;j++) { a[num++] = (double)(aa[j].y-aa[i].y)/(aa[j].x-aa[i].x); } sort(a,a+num); int count = 1; for(int i = 1;i<num;i++) { if(a[i]==a[i-1]) count++; else { count= 1; } if(count>max) max = count; } num = 0; } printf("%d\n",max+1); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator