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
欢迎参加IJCAI 2020麻将智能体竞赛,大奖等你拿!Welcome to IJCAI 2020 Mahjong AI competition with amazing prizes!

Re:非正值和超过21252的情况都考虑了,还是WA,谁来救救我!

Posted by ffxxjj199919 at 2019-10-03 17:36:24 on Problem 1006
In Reply To:非正值和超过21252的情况都考虑了,还是WA,谁来救救我! Posted by:296249221 at 2018-08-14 11:53:39
> #include<stdio.h>
> 
> int main()
> {
> 	int p;
> 	int e;
> 	int i;
> 	int d;
> 	int l;
> 	int m;
> 	int n;
> 	int output;
> 	int c = 1;
> 	int cycle1 = 23;
> 	int cycle2 = 28;
> 	int cycle3 = 33;
> 
> 	while (~scanf("%d%d%d%d", &p, &e, &i, &d))
> 	{
> 	if (p == -1 && e == -1 && i == -1 && d == -1)
> 	{
> 		break;
> 	}
> 	for (n = 1; n <= cycle1 * cycle2; n++)
> 	{
> 		for (m = 1; m <= cycle1 * cycle3; m++)
> 		{
> 			if (e + cycle2 * m < i + cycle3 * n)
> 			{
> 				continue;
> 			}
> 			else if (e + cycle2 * m > i + cycle3 * n)
> 			{
> 				break;
> 			}				
> else
> 			{
> 				for (l = 1; l <= cycle2 * cycle3; l++)
> 				{
> 				if (p + cycle1 * l < e + cycle2 * m)
> 				{							continue;
> 				}
> 				else if (p + cycle1 * l > e + cycle2 * m)				{
> 				break;
> 				}
> 				else
> 				{
> 				output = p + cycle1 * l - d;
> 				if (output <= 0)
> 				{
> 		               output = output + cycle1 * cycle2*cycle3;
> 				}
> 				if (output > cycle1*cycle2*cycle3)
> 				{
> 				output = output - cycle1 * cycle2*cycle3;
> 				}
> printf("Case %d: the next triple peak occurs in %d days.", c, output);
> 				break;
> 				}
> 				}
> 				break;
> 			}
> 		}
> 	}
> 	c++;
> }
> 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