| ||||||||||
| 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 | |||||||||
1118#include<iostream.h>
#include<stdio.h>
struct point
{
int x,y;
};
int main()
{
int n,i,j,k;
while(cin>>n&&n){
point *p=new point[n];
for(i=0;i<n;i++)cin>>p[i].x>>p[i].y;
getchar();
double a,b,c,d,e,f;
int m=0;int Max=0;
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
int T=2;
for(k=j+1;k<n;k++){
a=p[i].x*p[j].y;
b=p[k].x*p[i].y;
c=p[j].x*p[k].y;
d=p[k].x*p[j].y;
e=p[j].x*p[i].y;
f=p[i].x*p[k].y;
double t=a+b+c-d-e-f;
if(t==0)T++;
}
if(Max<T)Max=T;
}
}
cout<<Max<<endl;
delete p;
}
return 0;
}
谁有没有更好的办法啊?
我的总是超时!
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator