문제1297--Laser Shooting

1297: Laser Shooting

실행시간 제한: 1 Sec  메모리사용 제한: 128 MB
제출: 53  통과: 19
[제출] [채점기록] [묻고답하기]

문제 설명

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.

  • x, y1 and y2 will contain the same number of elements.
  • Each element of x will be between 1 and 1,000, inclusive.
  • Each element of y1 and y2 will be between -1,000 and 1,000, inclusive.
  • All targets will have positive lengths.

출력 설명

Output the answer of each test case on a separate line.

입력 예시 Copy

2
1
1 -1 1
2
1 -1 1
2 -2 2

출력 예시 Copy

0.5000
1.0000

출처/분류