| ||||||||||
| 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 error#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator