| ||||||||||
| 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 | |||||||||
help about 1006: i don't know what's the problem :(Every time got Wrong Answer problem! But i can't manage it.
int main()
{
int pc=23, ec=28, ic=33;
int p, e, i, d;
int px, ex, ix, cnt=0;
while(true)
{
cin>>p>>e>>i>>d;
cnt++;
if(p==e && e==i && i==d && i==-1)
break;
if(p==0 || e==0 || i==0 || d==0)
{
cout<<"Case "<<cnt<<": the next triple peak occurs in "<<21252<<" days.\n";
continue;
}
else
{
if(d>=p)
px = (d-p)%pc;
else
px = pc - (p-d)%pc;
if(d>=e)
ex = (d-e)%ec;
else
ex = ec - (e-d)%ec;
if(d>=i)
ix = (d-i)%ic;
else
ix = ic - (i-d)%ic;
for(int j=1; j<=21252; j++)
{
px = (px%pc)+1;
ex = (ex%ec)+1;
ix = (ix%ic)+1;
if(px==pc && ex==ec && ix==ic)
{
cout<<"Case "<<cnt<<": the next triple peak occurs in "<<j<<" days.\n"; break;
}
}// for
} // if
} // while
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator