Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

怎么总是WA啊 ,快疯了

Posted by yangover at 2008-04-15 20:41:37 on Problem 2606
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator