| ||||||||||
| 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 | |||||||||
RE??数组开够了呀#include<iostream>
#define N 1002
using namespace std;
struct point
{
int x ,y;
}p[N];
int main()
{
int online(int,int,int);
int n,i,j,k,count,longest;
while(cin>>n)
{
count=2; longest=0;
for(i=0;i<n;i++)
scanf("%d%d",&p[i].x,&p[j].y);
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
{
count=2;
for(k=j+1;k<n;k++)
{
if(online(i,j,k)) count++;
}
if(count>longest) longest=count;
}
cout<<longest<<endl;
}
}
int online(int i,int j,int k)
{
if((p[j].y-p[i].y)*(p[k].x-p[j].x)
==(p[k].y-p[j].y)*(p[j].x-p[i].x))
return 1;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator