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

哪位大牛帮我看看呗 我觉得肯定对了啊 可是一直runtime error

Posted by yuweiyang12345 at 2011-04-05 16:50:05 on Problem 1006
#include<iostream>
using namespace std;
int main()
{
	int p,e,i,d,j,k=0;
	int a[100];
	while(1)
	{
		cin>>p>>e>>i>>d;
	if( p<0 || e<0 || i<0 || d<0 || p>365 || e>365 || i>365 || d>365)break;
		for(j=1;;j++)
		{
		if( (j-p)%23 == 0 && (j-e)%28 == 0 && (j-i)%33 == 0 )
		{a[k]=j-d;k++;break;}
		if(j>21252)break;
		}
		
	}
	for(j=0;j<k;j++)
	cout<<"Case "<<j+1<<": the next triple peak occurs in "<<a[j]<<" 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