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:哪位大牛帮小第看一下.错哪了.总是wa?

Posted by xfxyjwf at 2005-06-12 22:51:04 on Problem 1006
In Reply To:哪位大牛帮小第看一下.错哪了.总是wa? Posted by:catoran at 2005-06-12 22:43:45
data - d 可能是负值(就算改了,你这样循环会超时)
> #include<stdio.h>
> void main(){
> 	int p,e,i,d;
> 	int count,data;
> 
> 	count=0;
> 
> 	while(1){
> 		
> 		scanf("%d%d%d%d",&p,&e,&i,&d);
> 		count++;
> 
> 		if(p==-1&&e==-1&&i==-1&&d==-1)    break;
> 
> 		else{
> 			
> 			for(data=1;;data++){
> 				if((data+23-p%23)%23==0&&(data+28-e%28)%28==0&&(data+33-i%33)%33==0){
> 					printf("Case %d: the next triple peak occurs in %d days.\n",count,data-d);
> 					break;
> 				}
> 			}
> 		}
> 	}
> }

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