Inspecting Radars |
There is a field represented with a polar coordinate plane that contains N objects placed at positions with integer
polar coordinates. The inspected model is located at the origin (0, 0) of the field and can detect objects at a distance less than
its detection range R through a scan area defined by four adjustment parameters , A, h, and H, whose
meaning is illustrated with the following figure:
Formally, the scan area of the model is the region described by the set of polar points
, A, h and H are four integer values where:
An object placed at (r,) will be displayed by the model if h r < h + H and + A, where the last inequality should be understood modulo 360o (i.e., adding and comparing angles in a circle).
Given N objects placed on the field, you must develop an inspection of the surveillance model through the implementation
of E experiments with specific parameterizations. For each experiment you have to find the maximal number of objects on the field
that the radar should display if the parameters (
0 < 360) and h (
0 h < R) are free to set
(as integer numbers), and the parameters H (
1 H R) and A (
0 A < 360) are given.
The input consists of several test cases. Each test case is described as follows:
For each test case you can suppose that there are not two different objects placed at the same integer polar coordinate. The last test case is followed by a line containing two zeros.
For each test case of the input, print E lines where the j-th line contains the maximal number of objects on the field that the radar should display according to the parameterization given for the j-th experiment ( 1 j E).
6 100 15 7 15 60 40 15 50 15 45 30 45 90 2 2 1 100 359 9 100 15 7 15 60 40 15 50 15 45 30 45 90 40 45 50 45 78 100 6 100 359 11 30 10 30 11 29 5 30 11 10 0 0
1 6 9 5 3 3 2 2