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

帮我看看我错在哪里了?5555555

Posted by ainibaobao at 2005-07-25 18:34:05 on Problem 1006
#include <iostream.h>
void main()
{
	int p;
	int e;
	int i;
	int n;
	int days;
	int temp_sum[21253];
	int temp_p;
	int temp_i;
	int temp_e;
	int sum;
	static int j;
	for(;;)
	{
		cin>>p>>e>>i>>days;
		if(p != -1 && e != -1 && i != -1 && days != -1)
		{
				j++;
				for(sum = i;sum <= 21252;sum = sum+33)
				{
					temp_p = (sum - p) % 23;
					temp_e = (sum - e) % 28;
					temp_i = (sum - i) % 33;
					if(temp_p == 0 && temp_e == 0 && temp_i == 0 && sum != 0)
					{
						break;
					}
				}
				temp_sum[j] = sum - days;
				}
			else
			{
				break;
			}
		}
	for(n = 1;n < j+1;n++)
	{
		cout<<"Case "<<n<<": the next triple peak occurs in "<<temp_sum[n]<<" days."<<endl;
	}
}

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