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 xianming01 at 2007-07-30 15:34:03 on Problem 1006
# include <iostream.h>
# include <math.h>
int main()
{
	int a2,a3,count=0,sum;
	float b1,b2,b3;
	int p,e,i,d;
	while(1)
	{
		cin>>p>>e>>i>>d;
		if(p==-1&&e==-1&&e==-1&&d==-1) break;
		count++;
		for(b1=1.0;;b1++)
		{
			b2=(p+23.0*b1-e)/28.0;
			a2=floor(b2);
			if((float)a2-b2==0.0)
			{
				b3=(p+23.0*b1-i)/33.0;
				a3=floor(b3);
				if((float)a3-b3==0) break;
			}
		}
		sum=int(p+23*b1-d)%21252;
		if(sum==0) sum=21252;
		cout<<"Case "<<count<<": the next triple peak occurs in "<<sum<<" days."<<endl;
	}
	return 0;
}
用很多例子都可以通过,为什么就是wrong answer 呢?

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