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 aztac at 2008-01-24 15:26:22 on Problem 1006
#include<stdio.h>
#include<math.h>
void main()
{
	int a[10][4],i,j,n=0;
	for(i=0;i<10;i++)
		for(j=0;j<4;j++)
			a[i][j]=0;
	for(i=0;i<10;i++)
	{
		scanf("%d%d%d%d",&a[i][0],&a[i][1],&a[i][2],&a[i][3]);
		if(a[i][0]==-1 && a[i][1]==-1 && a[i][2]==-1 && a[i][3]==-1)
			break;
		n=n+1;
	}
	for(i=0;i<n;i++)
	{
		for(j=a[i][3]+1;j<21253;j++)
			if((j-a[i][0])%23==0)
				break;
		for(;j<21253;j=j+23)
			if((j-a[i][1])%28==0)
				break;
		for(;j<21253;j=j+23*28)
			if((j-a[i][2])%33==0)
				break;
			printf("Case %d: the next triple peak occurs in %d days.\n",i+1,j-a[i][3]);
	}
}

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