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 sanguo6702 at 2009-01-14 19:17:12 on Problem 1006
#include<stdio.h>
main()
{
	int p,m,e,d,i,j,k=0,end=1;
	while(k+1)
    {end=1;
		scanf("%d%d%d%d",&p,&m,&e,&d);
     if(p==-1&&m==-1&&e==-1&&d==-1)
		break;
	 else k++;
	 for(i=0;i<=930;i++)
	{ for(j=0;j<=930;j++)
	  { 
		  if((23*i+p)==(28*j+m)&&(23*i+p-e+21252)%33==0)
		 {   
			  if((23*i+p-d)<=0)
			  {
				  printf("Case %d: the next triple peak occurs in %d days.\n",k,23*i+p-d+21252);
			  }
		      else if((23*i+p-d)>=21252)
			  {
				  printf("Case %d: the next triple peak occurs in %d days.\n",k,23*i+p-d-21252);
			  }
		      else
			  {
				  printf("Case %d: the next triple peak occurs in %d days.\n",k,23*i+p-d);
			  }
			  end=0;
			  break;
		  }
	    }  
	 if(end==0)
		 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