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

找到的测试数据都对了,还是wrong answer?

Posted by jilangguyan at 2010-05-14 20:32:42 on Problem 1006
#include<stdio.h>

void Input(long int *p,long int *e ,long int *i, int *d)
{
    scanf("%d%d%d%d",p,e,i,d);
}
long int  run(long int p,long int e,long int i,int d)
{
   long int ans,b;
	p=p%23;
	while(1)
	{
	while(1)
	{
        p=p+23;
		if(((p-e)%28==0)&&((p-i)%33==0))
			break;
	}
	
		ans=p-d;
   if(ans>0)
	return ans;
  
	}
}

void Output(int j,long int ans[])
{
	int i;
	for(i=1;i<=j;i++)
	{
	printf("Case %d: the next triple peak occurs in %d days.\n",i,ans[i]);
	}
}

int main()
{
    long int p,e,i,j=0,d,ans[1000];
	while(1)
	{
		Input(&p,&e,&i,&d);
		if((p==-1)&&(e==-1)&&(i==-1)&&(d==-1))
			break;
		j++;
		ans[j]=run(p,e,i,d);
	}
	Output(j,ans);
	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