A9312 | Bear and Floodlight
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
One day a bear lived on the $Oxy$ axis. He was afraid of the dark, so he couldn't move at night along the plane points that aren't lit. One day the bear wanted to have a night walk from his house at point $(l,0)$ to his friend's house at point $(r,0)$ , along the segment of length $(r-l)$ . Of course, if he wants to make this walk, he needs each point of the segment to be lit. That's why the bear called his friend (and yes, in the middle of the night) asking for a very delicate favor.
The $Oxy$ axis contains $n$ floodlights. Floodlight $i$ is at point $(x_{i},y_{i})$ and can light any angle of the plane as large as $a_{i}$ degree with vertex at point $(x_{i},y_{i})$ . The bear asked his friend to turn the floodlights so that he (the bear) could go as far away from his house as possible during the walking along the segment. His kind friend agreed to fulfill his request. And while he is at it, the bear wonders: what is the furthest he can go away from his house? Hep him and find this distance.
Consider that the plane has no obstacles and no other light sources besides the floodlights. The bear's friend cannot turn the floodlights during the bear's walk. Assume that after all the floodlights are turned in the correct direction, the bear goes for a walk and his friend goes to bed.
The $Oxy$ axis contains $n$ floodlights. Floodlight $i$ is at point $(x_{i},y_{i})$ and can light any angle of the plane as large as $a_{i}$ degree with vertex at point $(x_{i},y_{i})$ . The bear asked his friend to turn the floodlights so that he (the bear) could go as far away from his house as possible during the walking along the segment. His kind friend agreed to fulfill his request. And while he is at it, the bear wonders: what is the furthest he can go away from his house? Hep him and find this distance.
Consider that the plane has no obstacles and no other light sources besides the floodlights. The bear's friend cannot turn the floodlights during the bear's walk. Assume that after all the floodlights are turned in the correct direction, the bear goes for a walk and his friend goes to bed.
输入格式
The first line contains three space-separated integers $n$ , $l$ , $r$ $(1<=n<=20; -10^{5}<=l<=r<=10^{5})$ . The $i$ -th of the next $n$ lines contain three space-separated integers $x_{i}$ , $y_{i}$ , $a_{i}$ $(-1000<=x_{i}<=1000; 1<=y_{i}<=1000; 1<=a_{i}<=90)$ — the floodlights' description.
Note that two floodlights can be at the same point of the plane.
Note that two floodlights can be at the same point of the plane.
输出格式
Print a single real number — the answer to the problem. The answer will be considered correct if its relative or absolute error doesn't exceed $10^{-6}$ .
输入输出样例
输入 #1
2 3 5 3 1 45 5 1 45
输出 #1
2.000000000
输入 #2
1 0 1 1 1 30
输出 #2
0.732050808
输入 #3
1 0 1 1 1 45
输出 #3
1.000000000
输入 #4
1 0 2 0 2 90
输出 #4
2.000000000
In the first sample, one of the possible solutions is:
In the second sample, a single solution is:
In the third sample, a single solution is:

In the second sample, a single solution is:
In the third sample, a single solution is:

C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted