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

求高手指点,一直WA.

Posted by jerry6658812 at 2012-04-17 22:56:06 on Problem 1006
#include<iostream>
using namespace std;

int abd(int x)
	{if(x<0) return -x;
	 else return x;}

int main()
{
	int p[100],e[100],i[100],d[100],t[100];
	int m,x;
	int total;
	
	for(m=0;m<100;m++)
		{	cin>>p[m]>>e[m]>>i[m]>>d[m];
			if(p[m]==-1&&e[m]==-1&&i[m]==-1&&d[m]==-1)
					break;
	}
	
	total=m;

	for(m=0;m<total;m++)
		{
			for(x=d[m]+1;x<d[m]+21253;x++)
				{
					if(abd(x-p[m])%23==00&&abd(x-e[m])%28==0&&abd(x-i[m])%33==0)
								t[m]=x-d[m];
				}
	
		}
	
	for(m=0;m<total;m++)
		{
			printf("Case %d: the next triple peak occurs in %d days.\n",m+1,t[m]);
	}
		
	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