ECOO '12 R2 P3 - Airport Radar

View as PDF

Submit solution


Points: 10 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

A passenger jet leaves from John C. Munro International Airport in Hamilton, Ontario and flies on a straight path until it reaches its destination. When it begins its flight, it will be seen by the radar tower located at Munro Airport. Along its path, it will pass by other airports, each with its own radar tower. In some cases, the airplane will pass close enough to be seen, in others it won't. Your task is to determine how many radar screens the airplane will appear on during its flight.

The input will contain five sets of data. The first line of each set contains integers D, L and N. Integer D corresponds to the airplane's direction of travel in degrees relative to due East (East = 0, North = 90, West = 180, etc.). Integer L corresponds to the length of the flight (that is, the distance traveled). Integer N corresponds to the number of airports in the area, excluding Munro Airport. The next N lines each contain 3 integers X, Y, and R giving the coordinates of the airport (X, Y) and the range of its radar tower (R). Coordinates are relative to Munro Airport, which is assumed to be at location (0, 0). The X axis increases to the East and the Y axis increases to the North. All units are in kilometers, and you should assume that a radar tower can pick up any object that is at most R km away.

Write a program that will read each test case and print out the number of radar towers that will see the jet at some point during its flight.

Sample Input

45 234 3
100 100 25
-100 0 150
250 300 70
120 400 5
100 100 25
-100 120 50
-230 270 70
-250 -250 200
-200 345 10

Sample Output

The jet will appear on 3 radar screens.
The jet will appear on 4 radar screens.

Note: Only 2 cases are shown in this sample.

Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org


Comments


  • 6
    d  commented on Dec. 27, 2018, 12:07 a.m.

    If the answer is 1, print

    The jet will appear on 1 radar screens.