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 |
Code Here. I want to know why!!!In Reply To:HELP!!!Runtime Error!!!EIGHT times!!! Posted by:oipn4e2 at 2008-06-29 22:38:30 #include <iostream> #include <cstdlib> using namespace std; #define Pm 100000000.0 static double x[900], y[900]; static double p[900]; int cmp(const void* a, const void* b){ return *(double *)a > *(double *)b ? 1 : -1; } int main(){ int i, j, k, t, N, max; while(scanf("%d",&N)!=EOF){ for(i=0;i<N;i++) cin>>x[i]>>y[i]; max=0; for(i=0;i<N;i++){ k=0; for(j=0;j<N;j++){ if(i==j) continue; if(x[i]==x[j]) p[k++]=Pm; else p[k++]=(y[j]-y[i])/(x[j]-x[i]); } qsort((void*)p,k,sizeof(p[0]),cmp); t=1; for(j=1;j<k;j++) if(p[j-1]==p[j]) t++; else{ if(t>max) max=t; t=1; } if(t>max) max=t; } cout<<max+1<<endl<<flush; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator