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,n; int j=1; int n1,n2,n3; int k1=1,k2=1,k3=1; while(1) { cin>>p>>e>>i>>d; if(p<0||e<0||i<0||d<0||d>=365) break; while((28*33*k1)%23!=(p%23)) { k1++; } n1=28*33*k1; while((23*33*k2)%28!=(e%28)) { k2++; } n2=23*33*k2; while((23*28*k3)%33!=(i%33)) { k3++; } n3=28*23*k3; n=(n1+n2+n3)%(23*28*33); cout<<"Case " <<j <<": the next triple peak occurs in " <<((n - d > 0) ? (n - d) : (23 * 33 * 28 + n - d)) <<" days." <<endl; j++; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator