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.
题意:证明一个矩形能不能放到另一个矩形内。
当要斜着比时 使3个顶点在大矩形上 看另一个在不在就行
因为矩形 所有α角都标出来了
小矩形对角线是sqrt(a*a+b*b),β=atan(b/a),γ=acos(x/d),α就知道了,然后再算两段的长,若是小于就能放,(本想把边算出来然后再求,式子倒是都出来了但没过,找时间再看看)还要注意的是小矩形不能碰到大的,只要碰到就不行 这几个比较改了n次= =
#include<stdio.h>
#include<math.h>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
double x,y,a,b;
scanf("%lf %lf %lf %lf",&x,&y,&a,&b);
if(x>y)
{
int m=x;
x=y;
y=m;
}
if(a>b)
{
int m=a;
a=b;
b=m;
}
// int flag=0;
if(x>a&&y>b)
{
printf("Escape is possible.\n");
}
else if(x<=a)
{
printf("Box cannot be dropped.\n");
}
else if(x*y<=a*b)
{
printf("Box cannot be dropped.\n");
}
else
{
// if(a*a+b*b-x*x<0)
// printf("Escape is possible.\n");
// else
// {
// double m=(x*b*b-a*b*sqrt(a*a+b*b-x*x))/(a*a+b*b);
// double jiao=asin(m/b);
// double h=(b-a/tan(jiao))*sin(jiao)+a/sin(jiao);
// double h=(x-(x*b*b+a*b*sqrt(a*a+b*b-x*x)/(a*a+b*b)))/a*b+(x*b*b+a*b+a*b*sqrt(a*a+b*b-x*x))/b*a;
double d=sqrt(a*a+b*b);
double jiao=atan(b/a)-acos(x/d);
double h=a*sin(jiao)+b*cos(jiao);
if(h<y)
printf("Escape is possible.\n");
else
printf("Box cannot be dropped.\n");
// }
}
}
}