题目传送门
题目描述
Lux has a plan to eliminate the invisible motionless enemy Teemo, whose location is detected by the Oracle Lens. She decides to cast an ultimate skill immediately, which would slay Teemo if hit because Lux has very high ability power.
Lux’s ultimate skill, Final Spark, is a powerful skill which can damage enemies by a straight beam of light with infinite length and ww meters width. It will deal damage to who shares at least a point with the light beam.
But Teemo - The Swift Scout - is a well-trained soldier. He will fleetly react to the Lux’s action, and try to dodge the ray by choosing a uniformly random direction and run along the direction. Between the first action of Lux and the moment the ray finally pokes out, Lux needs time to channel the ultimate, and during the channelling Teemo can run ss meters - note that Teemo always run in a straight line.
She should choose the direction of the Final Spark before any action is taken. At the instant before Lux casting the ultimate skill using the best strategy, she wonders how possible is the skill hit Teemo. She recalls that Teemo can be recognized as a circle with radius rr meters, and now Teemo is dd meters away from Lux.
It’s very hard for Lux to calculate it. Can you answer Lux the possibility of hitting Teemo when she uses the best strategy?
输入格式
The first line contains an integer
Each test case description contains the only line with four integers,
It is guaranteed that , so Teemo can not run through Lux, and the start of the light beam can not touch Teemo.
输出格式
For each test case, print a single number denoting the maximum possiblity on a separate line. The absolute error should not exceed
Formally, let your answer be , and the jury’s answer be . Your answer is accepted if and only if
输入
3
20 20 20 1000
0 0 100 1000
100 100 198 2000
输出 #1复制
1.000000000
0.000000000
0.503215306
说明/提示
In the first case of the example, Lux will shoot along the direction exactly through the center of Teemo. Teemo is unable to escape.
In the second case of the example, wherever Lux shoot, the possibility is because the possible position of Teemo forms a circle with radius , but the width of the ray and the diameter of Teemo are both .
题意
- 拉克丝在距离提莫
- 提莫在拉克丝抬手的时候可以任意一个方向移动
- 提莫视为半径为的圆,拉克丝大招范围宽度为
- 求命中提莫的概率
- 注意:由于出题人考虑不周,输入的不是提莫的半径r,而是提莫的直径t
题解
- 相同的数据都没有本质区别,因此可以转化为的题目来做。无论以什么角
度射入圆,我们都可以把圆旋转到激光为竖直的情况来开,因此问题就转化为用一个可水平平移的无限
长宽的长方形切一个半径为的圆能切下的最大边长。求导可知相切时边长取最大值,因此计算
相应弧长即可。 - 三分大师也许能通过这道题,但是太麻烦了,而且还可能被卡。
- 如图为原始问题
- 转变为下图问题
AC-Code