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 12619 at 2009-07-20 16:06:32 on Problem 1006
#include<stdio.h>
void main()
{
	long a,b,c,d;
	long i=1,k;
	while((scanf("%ld%ld%ld%ld",&a,&b,&c,&d))&&a!=-1&&b!=-1&&c!=-1&&d!=-1)
	{
          a%=23;
		  b%=28;
		  c%=33;
	      for(k=d+1;;k++)
		  {
			  if((k-a)%23==0&&(k-b)%28==0&&(k-c)%33==0)
			  {
				  printf("Case %ld: the next triple peak occurs in %ld days.\n",i,k-d);
				  i++;
				  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