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 zhangkeabcd at 2010-08-11 00:22:39 on Problem 1006
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d,i,tmp=1;
	while(scanf("%d%d%d%d",&a,&b,&c,&d)&&(a!=-1&&b!=-1&&c!=-1&&d!=-1))
	{
		for(i=1;i<=21252;i++)
		{
			if((i-a)%23==0&&(i-b)%28==0&&(i-c)%33==0)
			{
				printf("Case %d: the next triple peak occurs in %d days.\n",tmp,(i-d>0)?i-d:21252-(d-i));
				tmp++;
				break;
			}
		}
	}
	return 0;
}
我也觉得我的printf里面的代码有点强大。。。。暗暗佩服下自己。。。。

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