| ||||||||||
| 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.h>
int main()
{
int k,p,e,i,d,days;
for(k=1;;k++)
{
cin>>p,cin>>e,cin>>i,cin>>d;
if(p==-1)
break;
for(days=d+1;days<=21252;days++)
{
if((days-p%23)%23==0)
if((days-e%28)%28==0)
if((days-i%33)%33==0)
break;
}
cout<<"Case "<<k<<": the next triple peak occurs in "<<days-d<<" days."<<endl;
}
system("PAUSE");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator