| ||||||||||
| 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 | |||||||||
我试过了很多的组值,都是对的为什么它总告诉我WRONG ANSWER???????那位大哥帮帮我,求你了!!!!!!#include<iostream>
using namespace std;
int initialin(int in){return in%33;}
int initialem(int em){return em%28;}
int initialph(int ph){return ph%23;}
int peak (int a,int b,int c)
{
int x,y,z,i;
for(i=23;;i++)
{
x=i%23;
y=i%28;
z=i%33;
if(x==a&&y==b&&z==c)
{return i;}
}
}
void main()
{
int a,b,c,p,e,i,d,g,num(0);
while(1)
{
cin>>p>>e>>i>>d;
if(p==e&&e==i&&e==d&&d==-1)
{break;}
a=initialph(p);
b=initialem(e);
c=initialin(i);
g=peak(a,b,c);
cout<<"Case "<<++num<<": the next triple peak occurs in ";
cout<<g-d <<" days."<<endl;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator