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

Re:暴搜的,竟然过了,数据要求也应该不严吧,读懂题就行了~(PS:不知道剩余定理,一会儿看看去)

Posted by Web_Board at 2011-01-25 11:41:46 on Problem 1006
In Reply To:暴搜的,竟然过了,数据要求也应该不严吧,读懂题就行了~(PS:不知道剩余定理,一会儿看看去) Posted by:loganberry at 2011-01-22 18:00:54
嗯嗯,暴力无敌.偶也是暴过的.....
> //HDOJ 1370
> #include<stdio.h>
> int main()
> {
> 	int P,E,I,D;
> 	int i;
> 	int count=1;
> 	int temp;
> 	while(scanf("%d%d%d%d",&P,&E,&I,&D)!=EOF)
> 	{
> 		if(P==-1&&E==-1&&I==-1&&D==-1)
> 			break;
> 		if(P>=23)
> 			P=P%23;
> 		if(E>=28)
> 			E=E%28;
> 		if(I>=33)
> 			I=I%33;
> 		for(i=0;i<=21252;i++)
> 		{
> 			temp=i+D;
> 			if(temp%23==P&&temp%28==E&&temp%33==I&&temp!=D)
> 				break;
> 		}
> 		printf("Case %d: the next triple peak occurs in %d days.\n",count++,i);
> 	}
> 	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