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

47Ms暴力gcc,真是日了狗的题。。

Posted by InblooM at 2016-07-27 14:02:37 on Problem 1006
#include<stdio.h>
main()
{
	int i=1,h=1;
	int num1,num2,num3,num4,peak;
	scanf("%d %d %d %d",&num1,&num2,&num3,&num4);
	while(num1!=-1||num2!=-1||num3!=-1||num4!=-1)
	{
		num1=num1%23;
		num2=num2%28;
		num3=num3%33;
		peak=num3+33;
		if(num1==num2&&num2==num3&&num1>num4)
		{
			peak=num1-num4;
			h=0;
		}
		if(num1==num2&&num2==num3&&num1<=num4)
		{
			peak=num1+21252-num4;
			h=0;
		}
		//peak=num3+33;
		while(h)
		{
			while(((peak-num1)%23)!=0||((peak-num2)%28)!=0||peak-num4<0)
				peak+=33;
			peak=peak-num4;
			break;
		}
		printf("Case %d: the next triple peak occurs in %d days.\n",i,peak);
		h=1;i++;scanf("%d %d %d %d",&num1,&num2,&num3,&num4);
	}
}


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