hdu 1110 Equipment Box

//31MS    236K    715 B    C++ 
//数学题,注意斜着放的情况 
#include<stdio.h>
#include<math.h>
bool deal(double a,double b,double x,double y)
{ 
    if(a>x && b>y) return true;
    if(a*b <= x*y) return false;
    if(b<=y) return false;
    double dis=sqrt(x*x+y*y);
    double angle=asin(b/dis)-asin(y/dis);
    double len=x*cos(angle)+y*sin(angle);
    if(len>a) return false;
    return true;
}
int main(void)
{
    double a,b,x,y;
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lf%lf%lf%lf",&a,&b,&x,&y);
        if(a<b){ double t0=a;a=b;b=t0; }
        if(x<y){ double t0=x;x=y;y=t0; }
        if(deal(a,b,x,y))
            puts("Escape is possible.");
        else puts("Box cannot be dropped.");
    }
    return 0;
}

 

posted @ 2013-09-13 11:45  heaventouch  阅读(139)  评论(0编辑  收藏  举报