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

Why WA

Posted by lookus at 2005-07-06 20:44:46 on Problem 2468
#include <iostream.h>
#include <math.h>
int w,h,l,H;
inline int test(int a,int b,int c)
{
	if(w<a || h<b || l<c)
		return 0;
	if(b <= H)
		return 1;
	if(c<=H && b*c<=l*H && b*b+c*c<=h*h)
		return 1;
	if(a*a+b*b <= h)
	{
		double e = atan(a/b) + acos(H/sqrt(a*a+b*b));
		if(a*cos(e) + b*sin(e) <= w)
			return 1;
	}
   return 0;
}
void main()
{
	int a,b,c;
	while(cin>>w>>h>>l>>H>>a>>b>>c)
		if(test(a,b,c)||test(a,c,b)||test(b,a,c)||test(b,c,a)||
			test(c,a,b)||test(c,b,a))
			cout<<"The box goes on the truck."<<endl;
		else
			cout<<"The box will not go on the truck."<<endl;
}

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