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 20094154 at 2011-07-28 16:56:23 on Problem 1006 and last updated at 2011-07-29 20:33:36
郁闷顺便贴下代码:
#include"stdio.h"
#define m 4
int main()
{
	int i,j,k,a[m],b,t;
	k=1;
	while(scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3]),a[0]!=EOF)
	{
		for(i=1;i<=21252;i++)
		{
			if((i-a[0])%23==0&&(i-a[1])%28==0&&(i-a[2])%33==0)break;
		}
		if(i<=a[3])i=i+21252;
		t=i-a[3];
		if(t>21252)t=t-21252;
		printf("Case %d: the next triple peak occurs in %d days.\n",k,t);
		k++;
	}
	return 0;
}

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