"Tower Kang" navigation system

Source: Internet
Author: User

1293: "Tower Kang" navigation system time limit: 2 Sec memory limit: MB
submitted by: 208 resolution: 71
Submitted State [Discussion Version] Title Description

"Tower Kang" (tacan-tactical Air Navigation system) is the short-range tactical air navigation systems, developed by the United States in 1955, after the French, Germany, the United Kingdom, Canada, Japan, Korea and other widely used. Mainly used for carrier aircraft from tens kilometers meters to several hundred meters distance from the navigation, to ensure that the aircraft on a predetermined route to the target, the aerial assembly of the cluster, as well as in the complex meteorological conditions to guide the aircraft homing and entry and so on.

This is a polar coordinate radio air navigation system, when the flagship is set as the coordinate origin, the carrier aircraft can be positioned by acquiring the angle and distance from the origin of the coordinates.

But the positioning system now used by a fleet is an X-y Cartesian coordinate, and the fleet commander needs you to write a program that calculates the distance between the current location of the carrier and its flagship and the angle of the angle relative to the x-axis, so that the carrier can be navigated using the "cantata" Navigation system.

Input

There are several sets of test data. The first behavior is an integer t, which indicates that there is a T group of test data. Enter two integers x and y at the beginning of each set of data, indicating the coordinates of the flagship. then enter an integer n (1≤n≤100), indicating that there is an N-carrier machine, followed by n-line input, each line of two integer xi and Yi ( -1000≤xi,yi≤1000), representing the coordinates of the first-carrier aircraft.

Output

Outputs n rows, each line outputs two real numbers, representing the angle R (0 <= R <=) and the distance between the nth carrier machine and the flagship's angle relative to the x-axis (rounded to retain the two digits after the decimal point). For the specific format of the output, see the sample.

Sample input022 2-1 -30 021 2Sample output45.00 deg/2.83 miles71.57 deg/3.16 miles63.43 deg/2.24 miles45.00 deg/2.83 miles
#include <iostream> #include <cmath> #include <iomanip>using namespace Std;const double pi=3.1415927; int main () {    int a[110],b[110],t,n,i;    Double k,m,j;    while (CIN >> t)    {        while (t--)        {            cin >> a[0] >> b[0];            CIN >> N;            for (i=1;i<=n;i++)            {                cin >> A[i] >> b[i];            }        for (i=1;i<=n;i++)        {            j=sqrt ((a[i]-a[0]) * (a[i]-a[0]) + (b[i]-b[0]) * (b[i]-b[0]));            K= (ABS (a[i]-a[0))/j;            M=acos (k) * (180.0/PI);    cout << setiosflags (ios::fixed) << setprecision (2) << m << "DEG/";    cout << J << "KM" << Endl;    }} return 0;}


"Tower Kang" navigation system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.