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

实在找不出错在哪了 好郁闷!!

Posted by 1987 at 2005-04-08 19:17:54 on Problem 1828
#include <iostream.h>
#include <stdlib.h>
int cmp ( const void *,const void *);
void main()
{
	while(1)
	{
		int time;
		cin>>time;
		if(time==0)
			break;
		long a[50001],b[50001];
		for(int i=0;i<time;i++)
		cin>>a[i]>>b[i];
		int temp1=0;
		int temp2=0;
		int d1=1;
		int d2=1;
		
		for(i=1;i<time;i++)
		{	
			//if( (a[i]==a[temp1])&&(b[i]==b[temp1]) )
			//d1++;
		
			//if( (a[i]==a[temp2])&&(b[i]==b[temp2]) )
			//d2++;

			if( (a[i]==a[temp1])&&(b[i]==b[temp1])|| (a[i]==a[temp2])&&(b[i]==b[temp2]) );
			else
			if( (a[i]>=a[temp1])&&(b[i]>=b[temp2]) )
			{
				temp1=i;
				temp2=i;
				d1=1;
				d2=1;
			}

			if( (a[i]>=a[temp1])&&(b[i]>=b[temp2]) );
			else
			if((a[i]>a[temp1]))
				{
					d1=1;
					temp1=i;
				}
				if((b[i]>b[temp2]))
				{
					d2=1;
					temp2=i;
				}
		}
		if(temp1==temp2)
			cout<<d1<<endl;
		else
		cout<<d1+d2<<endl;
	}
}

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