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 xiaoxiaodi at 2006-01-10 20:50:57 on Problem 1006
#include<stdio.h>
#include<math.h>
void  main()
{
	    int p,e,d,i,j=0,k=1,flag1=0,flag2=0,flag3=0,temp;
	    scanf("%d",&p);
	    scanf("%d",&e);
	    scanf("%d",&i);
	    scanf("%d",&d);
	    while(flag1==0)
	    {
	    	   if(flag3==0)
	    	   {
	    	   	    if((p<0)||(e<0)||(i<0)||(d<0))  return;
					else
					{
	    	   	        if((p>365)||(e>365)||(i>365)||(d>365)) return;
					}
	    	   	    flag3++; 
	    	   	}
	    	   	temp=j*33+i;
	    	   	if((abs(temp-p)%23==0)&(abs(temp-e)%28==0))
	    	   	{
	    	   		if((p==e)&(e==i))
	    	   		{
	    	   			  if(flag2==0) flag2++;
	    	   	  	  else  
	    	   	  	  {
	    	   		    	printf("Case %d: the next triple peak occurs in %d days.\n",k,temp-d);
	    	   		    	k++;
                         p=e=i=0;
	                  scanf("%d",&p);
	                  scanf("%d",&e);
	                  scanf("%d",&i);
	                  scanf("%d",&d);
	                  flag3=0;
                      temp=0;
	                  flag2=0;
	                  j=-1;
	    	   	  	  }
              }
              else  
	    	   	  	  {
	    	   		    	printf("Case %d: the next triple peak occurs in %d days.\n",k,temp-d);
	    	   		    	k++;
	                  scanf("%d",&p);
	                  scanf("%d",&e);
	                  scanf("%d",&i);
	                  scanf("%d",&d);
	                  flag3=0;
                   temp=0;
	                  flag2=0;
	                  j=-1;
	    	   	  	  }
	    	}
	    	 j++;
    }
}

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