CF 二分
来源:互联网 发布:linux自动挂载 编辑:程序博客网 时间:2024/05/22 13:34
http://codeforces.com/gym/100796/problem/I
二分
I. Shell Game
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Bob has discovered a new quality in himself — he likes to trick people a lot! In particular, Bob wants to try his tricking skills in the shell game.
The shell game involves three identical cups and a single ball. In the beginning the host (that's Bob!) puts the cups upside down and places the ball inside one of the cups. Then he shuffles the cups and the player has to guess where the ball is. The host then lifts that cup, revealing whether the ball was inside or not. The player wins if he makes a correct guess, otherwise the host wins.
The form of each cup is a sliced cone. Formally, the base of the cup is a circle with radius r, and the opening of the cup is a circle with radius R. The height of the cup is equal to h. A ball for the shell game is simply a sphere.
What the player is not going to know is that Bob smeared the inner surface of each cup with glue, resulting in the cup holding the ball when Bob lifts it up — so the player will never win! However, the ball will stick only if it touches the inner surface of a cup. For this reason Bob wants to get the largest possible ball that fits inside the cup when the cup is placed upside down on the table.
Bob has already found three identical cups in his grandmother's locker — now he only has to buy a ball of the required size so that he may start playing the shell game. Help Bob and calculate the largest size of such a ball!
Input
The first line contains three space-separated integers r, R and h, the radii of the base and the opening, and the height of the cup (1 ≤ r < R ≤ 104, 1 ≤ h ≤ 104).
Output
Output a single number — the radius of the largest ball that can fit in the cup. Your answer will be considered correct if its relative or absolute error doesn't exceed 10 - 6.
Examples
input
3 4 8
output
3.531128874149
点到直线的距离公式用一下就可以了,然后要注意有两个条件限制,一个是点到直线的距离显示,还有一个就是mid不能超过h的1/2
- CF 二分
- cf 371c 二分
- cf 551 C(二分)
- cf 689 C(二分)
- CF:!Hasan(二分)
- CF 493C 二分
- CF 实力二分
- CF Spider's Web 二分
- CF 287B(Pipeline-二分)
- [cf]287B Pipeline【二分】
- [CF 279B]Books[二分]
- cf-348A 二分暴力
- 二分 cf 343c div1
- cf 484B 二分+贪心
- CF 589F 贪心+二分
- Cf 361div2 C [二分]
- cf中的一道二分题
- CF 830A 贪心+二分
- 顺序栈
- getline( cin,s,'\n' )不能读取最后一条输入的问题
- Fragment生命周期
- ecshop验证码不显示
- Struts2 笔记3
- CF 二分
- dfs深度优先搜索
- STM32f103 看门狗使用
- 利用select函数实现非阻塞式的socket accept
- C++实验3—定期存款利息计算器
- 链式栈
- JAVA+Selenium环境配置进行web页功能自动化的测试
- 关于mysql事件处理的方法
- JAVA中HashMap如何删除元素