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> #include <cstdio> using namespace std; int main () { int p,e,i,d,res,k,j; k=1; while(scanf("%d%d%d%d",&p,&e,&i,&d)!=EOF) { if(p==-1 && e==-1 && i==-1 && d==-1) break; for(j=1;j<=21252;j++) { if((j-p)%23==0 && (j-e)%28==0 && (j-i)%33==0) break; } res=j-d; if(res<=0) res+=21252; printf("Case %d: the next triple peak occurs in %d days.\n",k++,res); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator