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

16MS

Posted by makerofu at 2012-02-26 20:44:26 on Problem 1006
#include <stdio.h>


int main()
{
	int p,e,i,d,k1;
	int icase=1;
	
	while(icase)
	{
		scanf("%d %d %d %d",&p,&e,&i,&d);
		if(p==-1&&e==-1&&e==-1&&d==-1) break;


		k1 = (21*p-10*i-11*e)*13;

		k1 %= 33;
		if(k1<0) k1+=33;

		k1=k1*28+11*(e-p);


		k1 = 23*k1+p-d;

	
		while(k1<=0) k1+=21252;
		while(k1>21252)k1-=21252;

		printf("Case %d: the next triple peak occurs in %d days.\n",icase,k1);
		
		icase ++;
	}
	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