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

AC,开心开心。提示天数不能为负。10 5 0 34 21252

Posted by 121700 at 2021-04-16 22:12:04 and last updated at 2021-04-16 22:13:00
#include<stdio.h>
int main(int argc,char *argv[])
{
	int i=0,a=0,b=0,c=0,d=0,q[10200]={0},n=0;
	while(a!=-1&&b!=-1&&c!=-1&&d!=-1)
	{
		scanf("%d %d %d %d",&a,&b,&c,&d);
		if(d>365)
			return 0;
		if(d<0&&d!=-1)
			return 0;
	for(i=0;i<21252;i++)
	{	
		if(a%23==0&&b%28==0&&c%33==0)
			break;
		if(a==24&&b==29&&c==34)
			break;
		a++;b++;c++;
	}
	if(a==24&&b==29&&c==34||(b-a==5&&c-b==5))
	{	if(d==0)
			q[n]=1;
		else
			q[n]=21252-d+1;
		n++;
	}
	else
	{
		q[n]=21252-i-d;n++;
	}

	}


	for(i=0;i<n-1;i++)
	{
		if(q[i]<=0)
		printf("Case %d: the next triple peak occurs in %d days.\n",i+1,q[i]+21252);
		else
		printf("Case %d: the next triple peak occurs in %d days.\n",i+1,q[i]);
	}
	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