Codeforces Gym 100002 B Bricks 枚举角度

时间:2022-07-13 13:12:58

Problem B Bricks"

Time Limit: 1 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/gym/100002

Description

The *er of the "IF" castle has decided to run away by disassembling the brick wall in his * 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 *er 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 &quot&semi;Cricket Field&quot&semi; 暴力

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

  2. Codeforces Gym 100002 E &quot&semi;Evacuation Plan&quot&semi; 费用流

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

  3. Codeforces Gym 100002 Problem F &quot&semi;Folding&quot&semi; 区间DP

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

  4. Codeforces Gym 100002 D&quot&semi;Decoding Task&quot&semi; 数学

    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&period;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&lpar;枚举角度&rpar;

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

随机推荐

  1. scikit-learn一般实例之四&colon;使用管道和GridSearchCV选择降维

    本例构建一个管道来进行降维和预测的工作:先降维,接着通过支持向量分类器进行预测.本例将演示与在网格搜索过程进行单变量特征选择相比,怎样使用GrideSearchCV和管道来优化单一的CV跑无监督的PC ...

  2. ZOJ 3705 Applications 模拟

    #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include&lt ...

  3. 【云计算】Docker集中化web界面管理平台shipyard

    Docker集中化web界面管理平台shipyard docker shipyard seanlook                        2015年01月05日发布             ...

  4. python学习笔记三 深浅copy,扩展数据类型(基础篇)

    深浅copy以及赋值 对于字符串和数字而言,赋值.浅拷贝和深拷贝无意义,因为其永远指向同一个内存地址. import copy n1 = #n1 = 'hahahaha' #赋值n2 = n1#浅co ...

  5. C&num; WinForm多线程(三)---- Control&period;Invoke&lbrack;转&rsqb;

    开发中遇到更新Winform中控件假死问题,通过看了这篇文章了解了原理,感谢!此处标记起来,以备查看! 原文地址:http://www.cnblogs.com/joechen/archive/2009 ...

  6. android自定义控件 onMeasure&lpar;&rpar; 测量尺寸

    上次讲的自定义控件刷新点屏幕的任意地方都会刷新,而且在xml里自定义控件下面放一个textview的话,这个TextView是显示不出来的,不只这个,以前的几个自定义控件都是 为什么呢?今天来讲下on ...

  7. php类与构造函数解析

    关于类大家都有一定的认识这里只介绍在php中类值得注意的地方----类的创建----php使用关键字class创建一个类,并且使用一对大括号如: class name{ public $n=&quot ...

  8. 教你如何前后端完全分离(非api、ajax)

    我的前后分离,不是api,不是ajax,我这里只讨论html与后端结合 前话 曾经风靡一时的dedecms相信做网站的十有八.九都知道,还有那么一些不是技术出生的人,通过看一下文档,也能访问出网站出来 ...

  9. qrcode &amp&semi; vue

    qrcode & vue $ yarn add qrcode.vue # OR $ npm i -S qrcode.vue https://www.npmjs.com/package/qrco ...

  10. pip install beautifulsoup4&period;失败

    在学习python爬虫时,用到bs4解析网页,开始遇到安装bs出错 Collecting beautifulsoup4Exception:Traceback (most recent call las ...