Problem B Bricks"

Time Limit: 1 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/gym/100002

Description

The prisoner of the "IF" castle has decided to run away by disassembling the brick wall in his prison cell. To hide his work from his jailors he shall get rid of the bricks that he removes from the wall. All bricks have a shape of rectangular parallelepiped with the size of A × B × C inches and are so strong that they are impossible to break. However, there's a small rectangular sewer hole in the cell's floor with the size of D × E inches that goes deep down as a rectangular well of the same size (so deep it is, that its depth could not be measured and can be neglected). The prisoner have precisely (up to a tenth of an inch!) measured all the sizes A, B, C, D, E and wants to know if it is possible to dispose of the castle's bricks through the hole in the floor. Please, answer this question for him.

Input

The input file consists of a single line with 5 numbers A, B, C, D, and E separated by spaces. A, B, C are the lengths of brick's sides, and D, E are the lengths of hole's sides. All lengths are at least 1 and at most 10 inches and have at most 1 digit after decimal point.

Output

Write to the output file a single word YES if it is possible to dispose of the bricks through the hole or NO otherwise.

Sample Input

1.0 2.0 1.5 1.4 1.0

Sample Output

NO

HINT

 

题意

给你一个无限深矩形的洞和一个立方体,问你这个立方体能否放入这个洞里面

题解:

注意可以斜着放

那就枚举角度往里面塞就行了

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <bitset>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 110000
#define mod 10007
#define eps 1e-9
#define pi 3.1415926
int Num;
//const int inf=0x7fffffff; //§ß§é§à§é¨f§³
const ll Inf=0x3f3f3f3f3f3f3f3fll;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************** double a[],d,e;
int flag=;
void solve(int x,int y)
{
for(double i=;i<=;i+=0.001)
{
double ttt = i*pi/;
double l = a[x]*cos(ttt)+a[y]*sin(ttt);
double k = a[x]*sin(ttt)+a[y]*cos(ttt);
if(l<=d&&k<=e)
{
cout<<"YES"<<endl;
flag=;
return;
}
}
}
int main()
{
freopen("bricks.in","r",stdin);
freopen("bricks.out","w",stdout);
for(int i=;i<;i++)
cin>>a[i];
cin>>d>>e;
for(int i=;i<;i++)
{
for(int j=;j<;j++)
{
if(i==j)
continue;
solve(i,j);
if(flag)
return ;
}
}
printf("NO\n");
}

Codeforces Gym 100002 B Bricks 枚举角度的更多相关文章

  1. Codeforces Gym 100002 C "Cricket Field" 暴力

    "Cricket Field" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/1000 ...

  2. Codeforces Gym 100002 E "Evacuation Plan" 费用流

    "Evacuation Plan" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

  3. Codeforces Gym 100002 Problem F "Folding" 区间DP

    Problem F "Folding" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/ ...

  4. Codeforces Gym 100002 D"Decoding Task" 数学

    Problem D"Decoding Task" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com ...

  5. Codeforces Gym 101190M Mole Tunnels - 费用流

    题目传送门 传送门 题目大意 $m$只鼹鼠有$n$个巢穴,$n - 1$条长度为$1$的通道将它们连通且第$i(i > 1)$个巢穴与第$\left\lfloor \frac{i}{2}\rig ...

  6. Codeforces gym 101343 J.Husam and the Broken Present 2【状压dp】

     2017 JUST Programming Contest 2.0 题目链接:Codeforces gym 101343 J.Husam and the Broken Present 2 J. Hu ...

  7. CodeForces Gym 100213F Counterfeit Money

    CodeForces Gym题目页面传送门 有\(1\)个\(n1\times m1\)的字符矩阵\(a\)和\(1\)个\(n2\times m2\)的字符矩阵\(b\),求\(a,b\)的最大公共 ...

  8. Codeforces GYM 100876 J - Buying roads 题解

    Codeforces GYM 100876 J - Buying roads 题解 才不是因为有了图床来测试一下呢,哼( 题意 给你\(N\)个点,\(M\)条带权边的无向图,选出\(K\)条边,使得 ...

  9. HDU 4454 Stealing a Cake(枚举角度)

    题目链接 去年杭州现场赛的神题..枚举角度..精度也不用注意.. #include <iostream> #include <cstdio> #include <cstr ...

随机推荐

  1. HashMap的两种遍历方式

    HashMap的两种遍历方式 HashMap存储的是键值对:key-value . java将HashMap的键值对作为一个整体对象(java.util.Map.Entry)进行处理,这优化了Hash ...

  2. Devexpress GridControl z

    http://minmin86121.blog.163.com/blog/static/4968115720144194923578/ 1 AllowNullInput=False; --Devexp ...

  3. LAMP网站架构分析

    转自:http://www.williamlong.info/archives/1908.html LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架,该框架包 ...

  4. javascript 面向对象制作坦克大战 (一)

    PS:这个坦克大战是在网上下的一段源码之后,自己进行的重写.   写这个的目的是为了巩固自己这段时间对js的学习.整理到博客上,算是对自己近端时间学习js的一个整理. 同时也希望可以帮助到学习js的园 ...

  5. [原创]个人工具 - YE快速复制助手(YeFastcopyHelper)

    版本:v1.3.216 更新时间:2014/02/16 * 代码完善 + 右键关于显示当前版本号,点击并链接到软件帮助页 Technorati 标签: NET,.NET 3.5,asion C#,Ch ...

  6. c++ 概念及学习/c++ concept&learning(二)

    上篇内容讲述了整个语言的发展[为什么会产生编程语言],以及学习C++所需要掌握的内容.这节开始认识第一部分最基本的内容:C++的内建类型,也就是基本类型. 在这些知识之前留一个问题:为什么基本所有语言 ...

  7. Spark系列(六)Master注册机制和状态改变机制

    各组件的注册流程如下图: 注册机制源码说明: 入口:org.apache.spark.deploy.master文件下的receiveWithLogging方法中的case RegisterAppli ...

  8. 三、python高级特性(切片、迭代、列表生成器、生成器)

    1.python高级特性 1.1切片 list列表 L=['Mli','add','sal','saoo','Lkkl'] L[0:3]  #即为['Mli','add','sal']  从索引0开始 ...

  9. HDU ACM 1496 Equations

    Equations Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  10. 【转】手把手教你利用Jenkins持续集成iOS项目

    前言 众所周知,现在App的竞争已经到了用户体验为王,质量为上的白热化阶段.用户们都是很挑剔的.如果一个公司的推广团队好不容易砸了重金推广了一个APP,好不容易有了一些用户,由于一次线上的bug导致一 ...