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<stdio.h> int main() { int x,p,e,i,d,n=0; float a,b,c; while(scanf("%d%d%d%d",&p,&e,&i,&d)&&p!=-1&&e!=-1&&i!=-1&&d!=-1) { for(x=21252;x>=0;x--) { a=(x+(d-p))%23; if (a!=0) continue; else { b=(x+(d-e))%28; if(b!=0) continue; else { c=(x+(d-i))%33; if(c!=0) continue; else { n++; printf("Case %d: the next triple peak occurs in %d days.\n",n,x); break; } } } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator