17 1 s 128 MB
There is a laser cannon at coordinates (0, 0) on the cartesian plane. There are also several targets on the plane. Each target is a vertical line segment, and the endpoints of the i-th target are at coordinates (x[i], y1[i]) and (x[i], y2[i]). A random angle between -Pi/2 and Pi/2, inclusive, is chosen, and a single shot is fired. The angle -Pi/2 is straight down vertically, 0 is straight to the right horizontally, and Pi/2 is straight up vertically. A shot is a straight ray of infinite length starting from the point (0, 0). A shot hits a target if there is a common point between them. Compute the expected number of targets that will be hit by the single shot. Hitting a target doesn't change the direction of the laser shot.
The first line contains the number of test cases T (T ≤ 150).
For each test case, the number of targets N (1 ≤ N ≤ 50) will be given.
Following N lines will contain three integers seperated by spaces, x[i], y1[i] and y2[i] respectively.
2 1 1 -1 1 2 1 -1 1 2 -2 2