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. 创建job,delete定时清理数据

    Job定时删除数据 需求:对一个表,每天删除一月前的历史数据 思路 .编写SQL,删除一月前的历史数据,使用函数取值 .测试JOB创建,查询,维护,管理 .测试布置job,满足效果 ***测试数据准备 ...

  2. 微信小程序自定义组件,提示组件

    微信小程序自定义组件,这里列举了一个常用的提示自定义组件,调用自定义组件中的方法和字段.仅供参考和学习. 编写组件: 在根目录下添加“components”目录,然后像添加Page页面一样添加自定义组 ...

  3. Ado.Net查询语句使用临时表做条件

    using System; using System.Data; using System.Data.SqlClient; using System.Text; namespace WindowsFo ...

  4. 【SP1716】GSS3 - Can you answer these queries III(动态DP)

    题目链接 之前用线段树写了一遍,现在用\(ddp\)再写一遍. #include <cstdio> #define lc (now << 1) #define rc (now ...

  5. 【转载】C#中List集合SingleOrDefault和FirstOrDefault方法有何不同

    在C#的List集合类的操作过程中,有时候我们会使用到List集合的SingleOrDefault方法和FirstOrDefault等方法,这2个方法都是System.Linq.Enumerable类 ...

  6. js编写日历的思路

    首先写出一个日历我们需要考虑以下2个问题: 每个月的总天数 每个月的第一天周几 这里提供了一个判断平年闰年2月份天数的方法: function leapYear(year) { return (yea ...

  7. javascript高级程序设计阅读总结

    5章 引用类型 1.object类型 创建 1.var obj ={} ---对象字面量 2.var obj = new Object(); ---new操作符 2.Array类型 创建 1.var ...

  8. ArcEngine二次开发中运行出现There is no Spatial Analyst license currently available or enabled.

    只需要在许可控件上勾选空间分析功能即可.

  9. Entity framework 生成的SQL如何设置兼容低版本的数据(转载)

    来源:https://q.cnblogs.com/q/84401/ 右键 edmx 文件,有xml方式打开. 将ProviderManifestToken 改为 2008 .

  10. PHP传引用/作用域 问题

    $arr = [1,2,3]; foreach($arr as &$v) { //nothing todo. } foreach($arr as $v) { //nothing todo. } ...