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 wy at 2004-11-09 23:18:38 on Problem 1006
In Reply To:自我更新,增加考虑到在date之前就已经有个triple peak的状况 Posted by:wy at 2004-11-09 20:25:25
出的到底是什么数据啊........
调试是完全没问题的,难道还有我没想到的漏洞.......|||


#include "math.h"
#include "stdio.h"

void main()
{
	int p[15],e[15],i[15],d[15],tp[15];
	int j,k,lim;
	j=0;
	do
	{
		j++;
		scanf("%d %d %d %d",&p[j],&e[j],&i[j],&d[j]);
		if (p[j]-23>0) p[j]=p[j]%23;
		if (e[j]-28>0) e[j]=e[j]%28;
		if (i[j]-33>0) i[j]=i[j]%33;
	} while (p[j]!=-1 && e[j]!=-1 && i[j]!=-1 && d[j]!=-1);
	lim=j-1;
	for (j=1;j<=lim;j++)
	{
		for (k=1;;k++)
		{
			if ((k-i[j])%33!=0) 
				continue;
			else
			{
				if ((k-e[j])%28!=0) 
				    continue;
			    else
				{
					if ((k-p[j])%23!=0) 
				        continue;
			        else
					{
					    tp[j]=k-d[j];
						if (tp[j]<0) 
							tp[j]=tp[j]+21252;
						break;
					}
				}
			}
		}
	}
	for (j=1;j<=lim;j++)
	{
		printf("Case %d: the next triple peak occurs in %d days.\n",j,tp[j]);
	}
}

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