| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
runtime wrong
大家看看是因为数组长度的问题吗?应该怎么设定呢?
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator