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 liuyuxue at 2015-10-25 14:02:50 on Problem 1118
#include<stdio.h>
#include<math.h>
struct node{
 int x;
 int y;
}a[710];
int main() 
{
   int i,j,n,k;
   int sum=2,max=0;
   int aa,bb;
  while(scanf("%d",&n)!=EOF&&n)
  { 
	  if(n==0) break;
	  for(i=1;i<=n;i++)
	   scanf("%d %d",&a[i].x,&a[i].y);
   for(i=1;i<n-2;i++)
   {
	   for(j=i+1;j<n-1;j++)
       {
         aa=(a[i].y-a[j+1].y)*(a[j].x-a[j+1].x);
         bb=(a[i].x-a[j+1].x)*(a[j].y-a[j+1].y);
         if(aa==bb) sum++;
         if(max<sum) max=sum;
        }
   }
	printf("%d\n",max);  
 }
  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