• Equipment Box[HDU1110]


    Equipment Box

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
    Total Submission(s): 1105    Accepted Submission(s): 261

     

    Problem Description
    There is a large room in the Pyramid called Room-of-No-Return. Its floor is covered by rectangular tiles of equal size. The name of the room was chosen because of the very high number of traps and mechanisms in it. The ACM group has spent several years studying the secret plan of this room. It has made a clever plan to avoid all the traps. A specially trained mechanic was sent to deactivate the most feared trap called Shattered Bones. After deactivating the trap the mechanic had to escape from the room. It is very important to step on the center of the tiles only; he must not touch the edges. One wrong step and a large rock falls from the ceiling squashing the mechanic like a pancake. After deactivating the trap, he realized a horrible thing: the ACM plan did not take his equipment box into consideration. The box must be laid onto the ground because the mechanic must have both hands free to prevent contact with other traps. But when the box is laid on the ground, it could touch the line separating the tiles. And this is the main problem you are to solve.

     

     

     

    Input
    The input consists of T test cases. The number of them (T) is given on the first line of the input. Each test case consists of a single line. The line contains exactly four integer numbers separated by spaces: A, B, X and Y. A and Bindicate the dimensions of the tiles, X and Y are the dimensions of the equipment box (1 <= A, B, X, Y <= 50000).

     

     

     

    Output
    Your task is to determine whether it is possible to put the box on a single tile -- that is, if the whole box fits on a single tile without touching its border. If so, you are to print one line with the sentence "Escape is possible.". Otherwise print the sentence "Box cannot be dropped.".

     

     

     

    Sample Input
    2
    10 10 8 8
    8 8 10 10
     

     

    Sample Output
    Escape is possible.
    Box cannot be dropped.
     

     

    Source
    Central Europe 1999
     

     

    Recommend
    Eddy

    #include<math.h>
    #include<stdio.h>
    bool judge(double A,double B,double X,double Y)
    {
    	if (A*B<=X*Y) return false;
    	if (A<=X) return false;
    	if (A>X && B>Y) return true;
    	double len=sqrt(X*X+Y*Y);
    	double A0=asin(A*1.0/len);
    	double A1=atan(X*1.0/Y);
    	double A2=A0-A1;
    	double A3=atan(B*1.0/A);
    	double A4=A2+A3;
    	double l=len*sin(A4);
    	if (l<B) return true;
    	else return false;
    }
    int main()
    {
    	int T;
    	scanf("%d",&T);
    	double A,B,X,Y;
    	while (T--)
    	{
    		scanf("%lf%lf%lf%lf",&A,&B,&X,&Y);
    		if (A>B)
    		{
    			double tmp=A;
    			A=B;
    			B=tmp;
    		}
    		if (X>Y)
    		{
    			double tmp=X;
    			X=Y;
    			Y=tmp;
    		}
    		if (judge(A,B,X,Y)) printf("Escape is possible.
    ");
    		else printf("Box cannot be dropped.
    ");
    	}
    	return 0;
    }
    

     

  • 相关阅读:
    微软Blazor组件发布,DevExpress v19.1.8中可用:Charts新功能
    数据管理必看!Kendo UI for jQuery过滤器概述
    项目管理工具!DevExpress Winforms Gantt控件 v19.2强势来袭
    WPF界面开发:DevExpress WPF在GridControl中固定行时处理时刻
    bash文件操作之批量修改文件格式与重命名——二合一完美版
    ubuntu 查看文件编码并进行批量编码修改
    文件批量重命名
    Scanf--数据第一个字符是西文字符的scanf函数
    markdown格式速查
    markdown样式速查
  • 原文地址:https://www.cnblogs.com/dramstadt/p/3260415.html
Copyright © 2020-2023  润新知