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

看看我这答案正确,为什么总是RUN time Eorror!

Posted by lbcharry at 2005-05-22 09:42:19 on Problem 1006
我利用的是中国余数定理求的,应该很快啊!但就通不过啊
#include<iostream.h>
const int E=23,P=28,I=33,M=21252;
int main()
{
	int i,j;
	int e,p,d;
	int num[50];
    cin>>e>>p>>i>>d;
	j=0;
	while(e!=-1||p!=-1||d!=-1||i!=-1)
	{
          num[j]=((e%E)*5544+(p%P)*(-6831)+(i%I)*1288);//中国余数定理5544=28*33*6,-6831=-9*759
	if(num[j]<=0)
		num[j]+=((-num[j])/M+1)*M;
	num[j]-=d;
	j++;
	cin>>e>>p>>i>>d;
	
	}
	for(i=0;i<j;i++)
	{
		cout<<"Case "<<i+1<<": the next triple peak occurs in "<<num[i]<<" days."<<endl;
	}

	 
	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