Posted on 2008-04-13 14:55
superman 阅读(216)
评论(0) 编辑 收藏 引用 所属分类:
ZOJ
1 /* Accepted 1160 C++ 00:00.23 836K */
2 #include <iostream>
3
4 using namespace std;
5
6 int main()
7 {
8 int N;
9 cin >> N;
10
11 while(N--)
12 {
13 int p, e, i, d, n = 0;
14 while(cin >> p >> e >> i >> d)
15 {
16 if(p == -1 && e == -1 && i == -1 && d == - 1)
17 break;
18 int x = (p * 5544 + i * 1288 + e * 14421) % 21252 - d;
19 while(x <= 0)
20 x += 21252;
21 cout << "Case " << ++n << ": the next triple peak occurs in "
22 << x << " days." << endl;
23 }
24 if(N)
25 cout << endl;
26 }
27
28 return 0;
29 }
30