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 yuqian162914 at 2011-10-05 23:23:13 on Problem 1006
#include<iostream>
using namespace std;
int main()
{
	int p,e,i,d,n;
	int j=1;
	int n1,n2,n3;
	int k1=1,k2=1,k3=1;
	while(1)
	{
		cin>>p>>e>>i>>d;
		if(p<0||e<0||i<0||d<0||d>=365)
			break;
		while((28*33*k1)%23!=(p%23))
			{
				k1++;
			}
		n1=28*33*k1;
		while((23*33*k2)%28!=(e%28))
		{
		k2++;
		}
		n2=23*33*k2;
		while((23*28*k3)%33!=(i%33))
		{
		k3++;
		}
		n3=28*23*k3;
		n=(n1+n2+n3)%(23*28*33);
		cout<<"Case "
			<<j
			<<": the next triple peak occurs in "
			<<((n - d > 0) ? (n - d) : (23 * 33 * 28 + n - d))
			<<" days."
			<<endl;
			j++;
		}
	
    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