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 |
暴力大法好 32MS 测试数据结果可能有负的 贴代码#include<stdio.h> int t,g,z,d,num,tot; int main() { while(scanf("%d%d%d%d",&t,&g,&z,&d),t+g+z+d+4) { if(t==0&&g==0&&z==0) { num=21252; printf("Case %d: the next triple peak occurs in %d days.\n",++tot,num-d); continue; } for(int i=-15;i<=645;i++) { num=i*33+z; if((num-g)%28==0&&(num-t)%23==0&&(num-d)>0) { printf("Case %d: the next triple peak occurs in %d days.\n",++tot,num-d); 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