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

help about 1006: i don't know what's the problem :(

Posted by bigbigboy at 2007-01-17 18:48:57
Every time got Wrong Answer problem!  But i can't manage it.

int main()
{
	int pc=23, ec=28, ic=33;
	int p, e, i, d;
	int px, ex, ix, cnt=0;
	while(true)
	{
		cin>>p>>e>>i>>d;
		
		cnt++;
		if(p==e && e==i && i==d && i==-1)
			break;
		
		if(p==0 || e==0 || i==0 || d==0)
		{
			cout<<"Case "<<cnt<<": the next triple peak occurs in "<<21252<<" days.\n";
			continue;
		}
		else	
		{
			if(d>=p)
				px = (d-p)%pc;
			else
				px = pc - (p-d)%pc;
			
			if(d>=e)
				ex = (d-e)%ec;
			else
				ex = ec - (e-d)%ec;
			
			if(d>=i)
				ix = (d-i)%ic;
			else
				ix = ic - (i-d)%ic;
				
			for(int j=1; j<=21252; j++)
			{
			
				px = (px%pc)+1;
				ex = (ex%ec)+1;
				ix = (ix%ic)+1;
				
				if(px==pc && ex==ec && ix==ic)
				{
					cout<<"Case "<<cnt<<": the next triple peak occurs in "<<j<<" days.\n";					break;
				}
			}// for
		} // if
	} // while		
	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