Surveillance Camera
Time limit2sMemory limit128 MB
Compute the share of a convex polygon covered by a 90-degree camera at the midpoint of its first edge, printed as a reduced fraction.
- Level
Medium7 of 10
- Topics
- Geometry, Math, Number theory
- Solved
- No attempts yet
Problem
Sanggeun wants to install a surveillance camera in a room.
The room is a convex polygon in the plane. The camera can only go on a wall, and only at the midpoint of an edge.
The camera's field of view is bounded by two rays that leave the camera at 45 degrees to its wall, so the camera covers the 90 degree wedge that opens into the room. The room is convex, so no wall blocks the view.
Write a program that computes how much of the room the camera covers.
Input
The first line contains the number of test cases, which is at most 100.
The first line of each test case contains the number of vertices of the room, (). Each of the next lines contains two integers and , the coordinates of a vertex ().
The vertices are given in counter-clockwise order, and every interior angle is greater than 0 degrees and less than 180 degrees. The camera sits at the midpoint of the first two vertices.
Output
For each test case, print on one line the area the camera covers, taking the area of the whole room as .
Write the value as an irreducible fraction. Print the numerator and the denominator separated by a slash, in the form p/q, with and the greatest common divisor of and equal to . The ratio is always greater than and less than .