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