传送门:

http://acm.hdu.edu.cn/showproblem.php?pid=1110

Equipment Box

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

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
分析:
题目意思:
问你一个大矩形里面能不能放一个小矩形
 思路:
1.大矩形长边大于小矩形长边并且大矩形短边大于小矩形短边 肯定可以放进
 
2.小矩形面积大于大矩形或者小矩形最短边大于大矩形最短边 肯定放不下
 
3.画图。。。(图片拖起来看,文本格式问题。。。。。。。。。)

code:

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define max_v 25
bool f(double A,double B,double a,double b)
{
double d=sqrt(a*a+b*b);
double a1=asin(A/d);
double a2=asin(b/d)*2.0;
double h=cos(a1-a2)*d;
if(B>h)
return true;
else
return false;
}
int main()
{
int t;
bool flag;
scanf("%d",&t);
while(t--)
{
double A,B,a,b;
scanf("%lf %lf %lf %lf",&A,&B,&a,&b);
if(A<B)
swap(A,B);
if(a<b)
swap(a,b);
if(A>a&&B>b)//大矩形长边大于小矩形长边并且大矩形短边大于小矩形短边 肯定可以放进
{
flag=true;
}
else if(A*B<=a*b||b>=B)//小矩形面积大于大矩形或者小矩形最短边大于大矩形最短边 肯定放不下
{
flag=false;
}else
{
flag=f(A,B,a,b);
}
if(flag)
{
cout << "Escape is possible." << endl; }else
{
cout << "Box cannot be dropped." << endl; }
}
return ;
}

最新文章

  1. Jenkins配置自动发送邮件,成功!
  2. JS新手易错点
  3. Linux command’s Array
  4. WCF 遇到 由于线程退出或应用程序请求,已放弃 I/O 操作 ListenerContextInputStream
  5. 多路复用I/O poll()
  6. 2017-2-23 C#基础 中间变量
  7. iBatis &amp; myBatis &amp; Hibernate 要点记录
  8. 简单的Nginx自动化安装啊脚本
  9. sass 工具库
  10. 设计模式C++学习笔记之七(AbstractFactory抽象工厂模式)
  11. 《Linux内核设计与实现》 第五章学习笔记
  12. javascript基础学习系列-DOM盒子模型常用属性
  13. Java-1.6-并发包-集合
  14. C#枚举中使用Flags特性
  15. python爬虫 Scrapy2-- 爬取豆瓣电影TOP250
  16. 【BZOJ1042】硬币购物(动态规划,容斥原理)
  17. QT学习之窗口部件
  18. python 之 re模块(正则表达式)
  19. Liunx网络管理
  20. CentOS 7.3 关闭默认防火墙&amp;远程登录

热门文章

  1. jquery 添加关键字小插件
  2. 在SourceTree中使用Git submodule
  3. JS字符串与二进制的相互转化
  4. 如何取得GridView被隐藏列的值
  5. mysql 字符串转换呈毫秒值
  6. Bootstrap组件介绍
  7. scss-@extend
  8. 用js md5加密
  9. Instance Segmentation入门总结
  10. Eclipse Startup