| ||||||||||
| 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 | |||||||||
牛人帮忙,我花了好长时间了//1006
#include<iostream.h>
void main()
{
int num=0, t;
int p, e, i, d;
while(1)
{
cin>>p>>e>>i>>d;
if((p==-1)&&(e==-1)&&(i==-1)&&(d==-1))
break;
num++;
int j,m=0;
for(j=1; j<650; j++)
{
t=j*33+i;
if((t-p)%23==0&&(t-e)%28==0)
{
t-=d;
cout<<"case "<<num<<": the next triple peak occurs in ";
if(t<=0)
cout<<t+21252;
else
cout<<t;
cout<<" days.";
cout<<endl;
break;
}
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator