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 lxqlxq123 at 2011-03-19 13:13:39 on Problem 1118
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
  int n=1, i, j, k, b=0, arrayx[1000],arrayy[1000],  t, p=0;
  while(scanf("%d",&n),n !=  0){
          
      for(i=0;i<n;i++){
                       
         scanf("%d %d",&arrayx[i],&arrayy[i]);                 
      }
      if(n<=2){
          
          printf("%d\n",n);
          continue;
          }
      else{
      
          for( i=1;i<=n-2;i++){
                
              for( j=i+1;j<=n-1;j++){
                                       
                  int count = 2;
                  for( k=j+1;k<=n;k++){
              
                      if( (arrayx[i]-arrayx[j])*(arrayy[j]-arrayy[k])==(arrayx[j]-arrayx[k])*(arrayy[i]-arrayy[j]) )count++;
                    }
                   if(count>p)p = count;
                }
            }
         printf("%d\n",p);
          p=0;        
         }
        }   	
  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