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 wrong

Posted by FireLizard at 2007-10-21 19:24:30 on Problem 1006
大家看看是因为数组长度的问题吗?应该怎么设定呢?



#include<iostream.h>
void main()
{
	int p[21],e[21],i[21],d[21],j,k,x,y[21];
	for(j=0;;++j)
	{
		cin>>p[j]>>e[j]>>i[j]>>d[j];
		for(x=d[j]+1;;++x)
		{
			if((x-p[j])%23==0&&(x-e[j])%28==0&&(x-i[j])%33==0)
			{y[j]=x;break;}
		}
		if(p[j]==-1&&d[j]==-1&&i[j]==-1&&d[j]==-1)
			break;
	}
	for(k=0;k<=j-1;++k)
	{
		cout<<"Case "<<k+1<<": the next triple peak occurs in "<<y[k]-d[k]<<" days."<<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