| ||||||||||
| 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 | |||||||||
用孙子定理做 还94MS...求解Code:
#include <iostream>
using namespace std;
int main()
{
int p, e, i, d, ans;
int icase = 1;
while(icase)
{
cin >> p >> e >> i >> d;
if(p == -1 && e == -1 && e == -1 && d == -1)
break;
ans = (5544 * p + 14421 * e + 1288 * i ) % (23 * 28 * 33) - d;
while (ans <= 0)
ans += 21252;
cout << "Case " << icase << ": the next triple peak occurs in " << ans << " days." << endl;
icase ++;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator