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

当然错了

Posted by qu at 2005-09-10 12:28:48 on Problem 2606
In Reply To:受不了了,谁帮看看WA吧。。(内详) Posted by:Judas at 2005-09-10 07:36:20
> #include<iostream.h>
> 
> int main()
> {
> 	long n,x[200],y[200],flag;
> 	int i,j,k,max=0,num=2;	
> 	long a,b;
> 	cin>>n;	if(2==n)	{cout<<2<<endl;return 0;}
> 	flag=n/2;
> 	for(i=0;i<n;i++)	cin>>x[i]>>y[i];
> 
> 	for(j=0;j<n-1;j++)
> 	{
> 		num=2;
> 		for(k=j+1;k<n;k++)
> 		{
> 			//if(k==j)	continue;
> 			a=x[j]-x[k];b=y[j]-y[k];
> 			for(i=0;i<n;i++)
> 			{
> 				if(i==j||i==k)	continue;
> 				if(a*(y[j]-y[i])==b*(x[j]-x[i]) )//这里当两边都是等于0的时候有两种情况的:四个数随便取两个等于0,就等式相等了,怎么可能对的
	num++;
> 			}
> 			if(num>flag)	{cout<<num<<endl;return 0;}
> 			if(max<num)	max=num;
> 		}
> 	}
> 	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