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 p = 0, e = 0, i = 0, d = 0, c = 0; while (1) { scanf("%d %d %d %d", &p, &e, &i, &d); if (p == -1) break; c++; p %= 23; e %= 28; i %= 33; int t = 0; while (1) { int len = t++ * 23 + p; if (len <= d) continue; if ((len - e)%28 == 0 && (len - i)%33 == 0) { printf("Case %d: the next triple peak occurs in %d days.\n", c, len - 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