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

居然超时了~~哪个帮看一下

Posted by laohuaa at 2008-07-29 18:33:21 on Problem 1006
#include<stdio.h>

int main()
{
	int p;
	int e;
	int i;
	int d;
	int k;
	int a[100]={0};
	int j=0;
	int m;
	int n;
	scanf("%d %d %d %d",&p,&e,&i,&d);
	while((p!=-1)&&(e!=-1)&&(i!=-1)&&(d!=-1))
	{
		
		p=p%23;
		e=e%28;
		i=i%33;
		for(k=1;k<=21252;k++)
		{
			n=k+d;
			if((n%23==p)&&(n%28==e)&&(n%33==i))
			{	
				a[j++]=k;
				break;
			}
		}
		scanf("%d %d %d %d",&p,&e,&i,&d);

	}
	for(m=0;m<j;m++)
	{
		printf("Case ");
		printf("%d",m+1);
		printf(": the next triple peak occurs in ");
		printf("%d",a[m]);
		printf(" days.\n");
	}
	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