| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 0.5 초 (추가 시간 없음) | 2048 MB | 41 | 32 | 29 | 76.316% |
They finally did it! The flat-earthers managed to teleport themselves to an idealized flat world where no one can make fun of them anymore.
In this world, there is a perfectly straight, infinite road that runs along the $x$-axis. Instead of a sun, they have something more illuminating: a gigantic flashlight elevated above the road, positioned infinitely far away to the west (negative $x$-axis). This flashlight beams light at a precise angle with respect to the ground, illuminating the entire road.
There are $N$ flatlanders standing proudly at distinct positions along the road. As the light strikes each of them, it casts a shadow extending eastward (toward the positive $x$-axis).
Eager to show off their flat-world knowledge, the citizens want to calculate how much of the road is covered by their shadows. However, with shadows potentially overlapping, they need your help to figure it out. Given the positions of the flatlanders and their heights, can you calculate the total length of the road covered by their shadows?
The first line contains two integers $θ$ (10ドル ≤ θ ≤ 80$) and $N$ (1ドル ≤ N ≤ 10^5 $), indicating respectively the angle of the light beams and the number of flatlanders on the road. The angle is measured in degrees, clockwise from the ground to the light beams.
Each of the next $N$ lines contains two integers $X$ (0ドル ≤ X ≤ 3 \cdot 10^5 $) and $H$ (1ドル ≤ H ≤ 1000$), indicating that a flatlander of height $H$ is located at position $X$ along the road. It is guaranteed that no two flatlanders share the same location.
Output a single line with the total length of the road covered by the shadows of all flatlanders. The output must have an absolute or relative error of at most 10ドル^{-4}$.
45 3 50 150 0 100 100 200
300
60 3 50 150 0 100 100 200
215.47
30 3 50 150 0 100 100 200
446.41016