HDU 1110 Equipment Box (判断一个大矩形里面能不能放小矩形)
传送门:
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 0; }
心之所向,素履以往
分类:
ACM
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南