Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

用孙子定理做 还94MS...求解

Posted by chenjia0211 at 2012-04-12 11:09:57 on Problem 1006 and last updated at 2012-04-12 11:10:42
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator