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 plich at 2006-10-07 16:59:27 on Problem 1006
#include<stdio.h>
int t(long int p,long int e,long int i,long int d)
{
	long int j=1,k;
	for(;;++j)
	{
		if((p%23==(d+j)%23)&&(e%28==(d+j)%28)&&(i%33==(i+j)%33))
		{
			k=j;
			break;
		}
	}
	return k;
}
void main()
{
	long int p[50],e[50],i[50],d[50],N=0;
	for(;!((p[N-1]==-1) &&(e[N-1]==-1) &&(i[N-1]==-1) &&(d[N-1]==-1));N++)
	{
		do{
			scanf("%i%i%i%i",&p[N],&e[N],&i[N],&d[N]);
		}while((p[N]<-1)||(e[N]<-1)||(i[N]<-1)||(d[N]<-1)||(p[N]>365)||(e[N]>365)||(i[N]>365)||(d[N]>365));
	}
	N=0;
	for(;!((p[N]==-1) &&(e[N]==-1) &&(i[N]==-1) &&(d[N]==-1));N++)
	{
		printf("Case %i: the next triple peak occurs in %i days.\n",N+1,t(p[N],e[N],i[N],d[N]));
	}
}

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