eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Hidden Camera

Hidden Camera

John wants to put a hidden camera in a room. For this problem, we ignore the vertical dimension and treat the room as a two-dimensional object. The room has the shape of a convex polygon. The camera is placed on a wall, halfway between two corners. The camera has a limited view: the borders of the view are given by the two lines that intersect the wall at a \textbf{45} degree angle. John wants to know how much of the room is visible to the camera. Can you help him? \includegraphics{https://static.e-olymp.com/content/35/3511ca807c2736ce67004079d4126859fe982b1b.jpg} The room as described in the first sample. The camera (the dot) can view the shaded region. The limits are given by lines that make a \textbf{45} degree angle with the base wall. The area of the shaded region is \textbf{71.25}\% of the total area of the room. \InputFile On the first line one positive number: the number of test cases, at most \textbf{100}. After that per test case: \begin{itemize} \item one line with a single integer \textbf{n} (\textbf{3} ≤ \textbf{n} ≤ \textbf{1000}): the number of corners of the room. \item \textbf{n} lines with two space-separated integers \textbf{x} and \textbf{y} (\textbf{-10000} ≤ \textbf{x}, \textbf{y} ≤ \textbf{10000}): the coordinates of the corners. \end{itemize} The corners are given in counterclockwise order. All angles are strictly between \textbf{0} and \textbf{180} degrees. The camera is placed exactly halfway between the first two corners in the input. \OutputFile Per test case: \begin{itemize} \item one line with one floating point number: the ratio of the area that the camera can see and the total area of the room. This number should be accurate up to \textbf{10^\{-6\}} relative or absolute precision. \end{itemize}
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
2
5
-3 0
3 0
4 5
-2 8
-5 3
4
0 2
2 0
3 1
1 3
Вихідні дані #1
0.7125
0.5
Джерело The 2013 Benelux Algorithm Programming Contest, BAPC 2013