Give you two circles and a rectangle, your task is to judge wheather the two circles can be put into the rectangle with no part of circles outside the retangle.

Input

There are multiple test cases. In every test cast, there are four float-point numbers:

a, b, r1, r2

where, a and b are two sides of the rectangle, r1 and r2 are radii of the two circls.

Output

Print a "Yes", if the circles can be put into the rectangle. Otherwise, print a "No".

You can safely assume x < y, where x and y are float-point numbers, if x < y + 0.01.

Sample Input

5 4 1 1
5 4 1.5 2

Sample Output

Yes
No

//数学一本通习题 1
//ZOJ 1608 判断两个圆能否放入一个矩形中 //题意:给你一个矩形和两个圆,问能否把这两个圆放进矩形里(圆不能相交或包含) //最好(省空间)的放置方法显然是两个圆分别与两条对边相切,且这两个圆也相切
//假如两个圆是按上面的方法放的,且刚好能放下(即两组邻边分别与两个圆相切)
//那么假设两个圆圆心的距离是z
//以z为斜边,x平行于长,y平行于宽做直角三角形 ,则
//z=r1+r2
//x=a-r1-r2=a-z
//y=b-r1-r2=b-z
//所以,z是固定的,x和y取决于矩形的边长
//那么如果x^2+y^2==z^2的话,就是刚好能放下,>=就是能放下了 #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std; const int N=1e5+; double a,b,r1,r2;
double x,y,z; int main()
{
while(scanf("%lf%lf%lf%lf",&a,&b,&r1,&r2)!=EOF)
{
z=r1+r2;
if(a<b) //让a是长边,b是短边
swap(a,b);
if(r1<r2) //r1是大圆,r2是小圆
swap(r1,r2);
x=a-z,y=b-z;
if(x*x+y*y>=z*z)
puts("Yes");
else
puts("No");
}
return ;
}

ZOJ 1608 Two Circles and a Rectangle的更多相关文章

  1. ZOJ1608 Two Circles and a Rectangle

    Time Limit: 2 Seconds      Memory Limit: 65536 KB Give you two circles and a rectangle, your task is ...

  2. LightOJ 1366 - Pair of Touching Circles (统计矩形内外切圆对)

    1366 - Pair of Touching Circles   PDF (English) Statistics Forum Time Limit: 3 second(s) Memory Limi ...

  3. javascript: jquery.gomap-1.3.3.js

    from:http://www.pittss.lv/jquery/gomap/solutions.php jquery.gomap-1.3.3.js: /** * jQuery goMap * * @ ...

  4. how to detect circles and rectangle?

    opencv中对圆检测的函数为:HoughCircles(src_gray,circles,CV_HOUGHT_GRADIENT,1,src_gray.cols/8,200,100,0,0) circ ...

  5. ZOJ 1985 Largest Rectangle in a Histogram(刷广告)2010辽宁省赛

    Largest Rectangle in a Histogram Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21204 ...

  6. ZOJ 2589 Circles(平面图欧拉公式)

    [题目链接] http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2589 [题目大意] 给出一些圆,问这些圆可以把平面分为几个部 ...

  7. Java基础之在窗口中绘图——使用模型/视图体系结构在视图中绘图(Sketcher 1 drawing a 3D rectangle)

    控制台程序. 在模型中表示数据视图的类用来显示草图并处理用户的交互操作,所以这种类把显示方法和草图控制器合并在一起.不专用于某个视图的通用GUI创建和操作在SketcherFrame类中处理. 模型对 ...

  8. ZOJ题目分类

    ZOJ题目分类初学者题: 1001 1037 1048 1049 1051 1067 1115 1151 1201 1205 1216 1240 1241 1242 1251 1292 1331 13 ...

  9. zoj 1010 Area【线段相交问题】

    链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1010 http://acm.hust.edu.cn/vjudge/ ...

随机推荐

  1. 当base-package="controller.*"时,可见packageSearchPath为"classpath*:controller/*/**/*.class": 当base-package="controller.**"时,可见packageSearchPath为"classpath*:controller/**/**/*.class":

    今天在配置Spring的component-scan时,发现了一个有趣的问题.就是在指定base-package时,如果使用了星号通配符*,有时会出现类扫描不到的情况.下面研究一下这个问题. 先介绍一 ...

  2. 关于fastjson与jackson在反序列化bool型时的区别

    背景 在测试中,两个项目a,b的接口参数用到了Bool类型,当传参"0",项目a通过了,项目b报错了,排查了下,项目b的那个接口,在对传参反序列化时就出现了问题,最后发现两个项目使 ...

  3. vscode 连接远程服务器 sftp

    1.在vscode 应用商店搜索 sftp 下载安装 2.ctrl+shift+p 搜索sftp:config 生成sftp.json 3.配置你的服务器信息{ "name": & ...

  4. javascript 同源策略和 JSONP 的工作原理

    同源策略 同源策略是一个约定,该约定阻止当前脚本获取或操作另一域的内容.同源是指:域名.协议.端口号都相同. 简单地说,A 服务器下的 a 端口执行 ajax 程序,不能获取 B 服务器或者 A 服务 ...

  5. Unity3D 跨平台原理

    Unity3D的跨平台原理核心在于对指令集CIL(通用中间语言)的应用. 机理 首先需要知道,Unity中的Mono是基于 通用语言架构(Common Language Infrastructure, ...

  6. Disruptor与Netty实现百万级(十)

    实体对象: import java.io.Serializable; public class TranslatorData implements Serializable { private sta ...

  7. ①将SVN迁移到GitLab-单分支迁移

    将SVN上的代码迁移到GitLab上,实际原理是将所迁移的服务器上,拷贝SVN上的相关代码,在服务器上生成Git相关仓库,然后推送到GitLab仓库,并保存SVN相关的提交记录,分支,标签等信息. 一 ...

  8. PreparedStatement和批处理

    1.概述 PreparedStatement 接口继承了 Statement,并与之在两方面有所不同,它表示预编译的 SQL 语句对象. 首先,数据库会对预编译语句提供性能优化.因为预编译语句有可能被 ...

  9. iOS - WebRTC的实现原理

    再简单地介绍一下webrtc: WebRTC,名称源自网页实时通信(Web Real-Time Communication)的缩写,简而言之它是一个支持网页浏览器进行实时语音对话或视频对话的技术. 它 ...

  10. python取字母以及数字随机数

    一.这里用到了:String模块ascii_letters和digits ''.join(random.sample(string.ascii_letters + string.digits, 9)) ...