E. Two Circles and a Rectangle
Description
Give you two circles and a rectangle, your task is to judge whether 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 circles.
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.
Samples
Input Copy
5 4 1 1
5 4 1.5 2
Output
Yes
No
题意:
给一个矩形和两个圆,问矩形是否能够放开两个圆。
思路:
假设矩形的长为a,宽为b,大圆半径为r1,小圆半径为r2。
首先要满足的条件为b>2*r1。
再来考虑边界情况:
图片来源 可以看出直角三角形是满足条件的边界条件。
最后,其实不判0.01的精度的能过,就是直接cin没识别多组输入.
代码: