ZOJ 1608Two Circles and a Rectangle
来源:互联网 发布:数据翻译英语 编辑:程序博客网 时间:2024/06/14 16:36
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.
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.
5 4 1 1
5 4 1.5 2
Yes
No
一个矩形里放两个圆,显然一个放左上一个放右下,然后判断是否可行即可。
#include<bits/stdc++.h>using namespace std;const int N=1e5+10;float a,b,r1,r2;int main(){ while(~scanf("%f%f%f%f",&a,&b,&r1,&r2)) { if (a<r1+r1+0.01||b<r1+r1+0.01) {puts("No"); continue;} if (a<r2+r2+0.01||b<r2+r2+0.01) {puts("No"); continue;} float x=a-r1-r2,y=b-r1-r2; if (sqrt(x*x+y*y)<r1+r2+0.01) puts("No"); else puts("Yes"); } return 0;}
0 0
- zoj 1608 Two Circles and a Rectangle
- zoj 1608 Two Circles and a Rectangle
- ZOJ 1608Two Circles and a Rectangle
- ZOJ 1608 Two Circles and a Rectangle(简单计算几何)
- zoj 1608 Two Circles and a Rectangle 判断两个圆是否能放入一个矩形中
- ZOJ1608-Two Circles and a Rectangle
- ZOJ 1985: Largest Rectangle in a Histogram
- zoj 1985 - Largest Rectangle in a Histogram
- ZOJ 1985 Largest Rectangle in a Histogram
- SPOJ15709 Two Circles
- zoj 2589 Circles
- ZOJ-3900-Three Circles
- CodeForces 600D Area of Two Circles' Intersection 圆面积交 (POJ 2546, ZOJ 1597)
- ZOJ 1985 Largest Rectangle in a Histogram 迭代... 贪心
- Inscribed Circles and Isosceles Triangles
- UVA375Inscribed Circles and Isosceles Triangles
- URAL-1103. Pencils and Circles
- codeforces510--A. Fox And Snake--B. Fox And Two Dots
- 邮件发送--局域网中配置James邮件服务器(二)
- 接口的深入理解
- C语言编程练习——冒泡排序和选择排序
- Linux进程间通信——管道
- thrift java 例子入门(hello world)
- ZOJ 1608Two Circles and a Rectangle
- Unity人物换装阶段3(ConfigReady)
- 进制转换
- 浅谈java中的集合
- 二叉树的建立和各种遍历(java版)
- SSM框架+Maven——详细整合教程(Spring+SpringMVC+MyBatis)
- Docker mesos在生产环境的应用
- fiddler界面介绍及简单用法
- Elasticsearch TermQuery