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 |
怎么总是WA啊 ,快疯了#include<iostream> using namespace std; int main() { int n; float a,b,A,B,max=0,sum=0; long i,j,k; float f[10100],g[10100]; cin>>n; if(n==2) { cin>>a>>b; cin>>i>>j; cout<<"2"<<endl; } else { for(i=1;i<=n;i++) cin>>f[i]>>g[i]; for(i=1;i<n;i++) { for(j=i+1;j<=n;j++) { sum=2; for(k=1;k<=n;k++) { if((k==i)||(k==j)) continue; if(f[i]!=f[j]) { A=(g[i]-g[j])/(f[i]-f[j]); B=g[i]-A*f[i]; if(g[k]==(f[k]*A+B)) sum++; } if((f[i]==f[j])&&(f[k]==f[i])) sum++; } max=(max>sum)?max:sum; } } cout<<max<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator