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

1118

Posted by guanlianjun at 2007-06-11 12:26:39
#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:
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