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

23ms 的一个 C++ possible version

Posted by eason64 at 2010-08-04 18:50:15 on Problem 1006
#include <iostream>
using namespace std;

int main()
{
	int p, e, i, d, cnt = 1;
	while(cin >> p >> e >> i >> d, p != -1)
	{
		p %= 23;
		e %= 28;
		i %= 33;
		int t = 0, s;
		while(s = i + 33 * t, 
			! (s > d && (s - p) % 23 == 0 && (s - e) % 28 == 0 ) )
		{
			++t;
		}
		cout << "Case " << cnt++ << ": the next triple peak occurs in " << s - d << " days." << endl;
	}
	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