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.\n");
else printf("Box cannot be dropped.\n");
}
return 0;
}
Equipment Box[HDU1110]的更多相关文章
- HDU 1110 Equipment Box (判断一个大矩形里面能不能放小矩形)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1110 Equipment Box Time Limit: 2000/1000 MS (Java/Oth ...
- POJ 1380 Equipment Box (暴力枚举)
Equipment Box 题目链接: http://acm.hust.edu.cn/vjudge/contest/130510#problem/B Description There is a la ...
- HOJ题目分类
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...
- 2018年暑假ACM个人训练题7 题解报告
A:HDU 1060 Leftmost Digit(求N^N的第一位数字 log10的巧妙使用) B:(还需要研究一下.....) C:HDU 1071 The area(求三个点确定的抛物线的面积, ...
- Virtual Box配置CentOS7网络(图文教程)
之前很多次安装CentOS7虚拟机,每次配置网络在网上找教程,今天总结一下,全图文配置,方便以后查看. Virtual Box可选的网络接入方式包括: NAT 网络地址转换模式(NAT,Network ...
- Linux监控工具介绍系列——OSWatcher Black Box
OSWatcher Balck Box简介 OSWatcher Black Box (oswbb)是Oracle开发.提供的一个小巧,但是实用.强大的系统工具,它可以用来抓取操作系统的性能指标,用 ...
- 使用packer制作vagrant centos box
使用packer制作vagrant box:centos 制作vagrant box,网上有教程,可以自己step by step的操作.不过直接使用虚拟在VirtualBox中制作vagrant b ...
- 快速打造跨平台开发环境 vagrant + virtualbox + box
工欲善其事必先利其器,开发环境 和 开发工具 就是 我们开发人员的剑,所以我们需要一个快并且好用的剑 刚开始做开发的时候的都是把开发环境 配置在 自己的电脑上,随着后面我们接触的东西越来越多,慢慢的电 ...
- CSS3伸缩盒Flexible Box
这是一种全新的布局,在移动端非常实用,IE对此布局的相关的兼容不是很好,Firefox.Chrome.Safrai等需要加浏览器前缀. 先说说这种布局的特点: 1)移动端由于屏幕宽度都不一样,在布局的 ...
随机推荐
- 第19章 使用PXE+Kickstart部署无人值守安装
章节概述: 本章节将教会您通过PXE+DHCP+TFTP+VSftpd+Kickstart服务程序搭建出无人值守安装系统,从而批量部署客户机系统. 这种系统能够实现自动化运维.避免了重复性劳动,帮助提 ...
- 如何修改git的当前登录信息
(文章是从我的个人主页上粘贴过来的,大家也可以访问我的主页 www.iwangzheng.com) 之前用的大师的git登录名,后来开通了自己的,需要换成自己的,其实修改方式很简单. $vim .gi ...
- k-means
参考:http://www.cnblogs.com/jerrylead/archive/2011/04/06/2006910.html k-means是无监督的聚类算法,比较简单,但包含的思想不简单, ...
- IOC原理解释
spring ioc它其实是一种降低对象耦合关系的设计思想,通常来说,我们在一个类调用另一个类的方法的时候,需要不断的new新的对象来调用该方法,类与类之间耦合度比较高,有了ioc容器以后,ico容器 ...
- 查看别人的css
ie工具栏的“文件”选项选“另存为”到你本地电脑,存下来有两个文件 一个是空间名称命名的文件夹和html网页,文件加里有三个扩展名为.css的文件
- 【leetcode】Sort List
Sort List Sort a linked list in O(n log n) time using constant space complexity. 需要采用归并排序对链表进行操作. ...
- js:判断对象是否为空
var list = []; var param = {}; ....... var hasProp = false; for (var prop in param){ hasProp = true; ...
- 【linux】awk的使用
教程来自:http://www.runoob.com/linux/linux-comm-awk.html 教程中的例子很好,可以有助于快速上手awk.但是里面的细节介绍的并不清楚. 问题1:什么时候写 ...
- C++类的成员函数使用的一些小总结
From: http://blog.csdn.net/xiayefanxing/article/details/7607506 这一阵做项目代码开发的时候,用到了在一个C++文件中使用另一个类的成员函 ...
- Rap 安装和配置
本机环境 系统:CentOS 6.7 64 位 MySQL 5.6 JDK 1.8 Tomcat 8 Redis 3.0.7 Rap 0.14.1 Rap 说明 官网:https://github.c ...