| ||||||||||
| 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 | |||||||||
哪位高手帮我看哈子到底错在哪里啦?是不是思路错误呢?#include <iostream>
using namespace std;
int main()
{
int p,e,i,d,day,w=0;
while(1)
{ cin>>p>>e>>i>>d;
if(p==-1&&e==-1&&i==-1&&d==-1)
break;
p=p%23;e=e%28;i=i%33;
for(day=1;day<=21252;day++)
{
if((day+p)%23==0)
if((day+e)%28==0)
if((day+i)%33==0)
{ ++w;
break;
}
}
cout<<"Case "<<w<<": the next triple peak occurs in "<<day-d<<" 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