#P2013. 无线电测向
无线电测向
Description
A ship equipped with an antenna positioning device can determine its position by receiving signals from local lighthouses. Each lighthouse is fixed at a known point and emits a unique signal. When the ship detects a signal, it can rotate its antenna until the signal reaches maximum strength, thereby determining its relative position to that lighthouse. As long as signals from two lighthouses are received, it is possible to determine the ship’s current position.
Programming task: determine the ship’s position from a pair of lighthouse readings.
The positions of the lighthouses and the ship are given in a Cartesian coordinate system. The positive -axis points east, and the positive -axis points north. The ship’s heading is measured clockwise from due north in degrees. North is , east is , south is , and west is . The relative position of a lighthouse to the ship is given as the angle, measured clockwise in degrees, from the ship’s heading.
Input Format
The first line contains an integer, the number of lighthouses . Each of the next lines describes one lighthouse with its name, -coordinate, and -coordinate, separated by spaces.
Following the lighthouse data are three lines describing the ship: one line for the ship’s heading, and two lines for the two received lighthouse signals.
Details are as follows:
| Input item | Meaning |
|---|---|
| Heading | The ship’s heading. |
| Name 1, Angle 1 | The name of the first lighthouse and its bearing. |
| Name 2, Angle 2 | The name of the second lighthouse and its bearing. |
The bearing of a lighthouse is the angle between the line from the ship to the lighthouse and the ship’s heading, measured clockwise from the ship’s heading. The two items on each of the last two lines are separated by a space.
Output Format
Output the ship’s position, accurate to 2 decimal places. If the ship’s position cannot be determined, output NO ANSWER (do not use lowercase).
5
a 1 5
b 1 1000
c 2 4
d 51 60
e 153 79
30
e 160
d 210
160.83 123.41
Hint
For 100% of the testdata, , and lighthouse names contain at most 20 letters.
Translated by ChatGPT 5
京公网安备 11011102002149号