Baidu star qualifying round I: Map money saving plan

Source: Internet
Author: User
I: Map cost saving plan
    • View
    • Submit
    • Statistics
    • Question
Time limit:
1000 ms
Memory limit:
65536kb
Description

Baidu map has its own coordinate system (you can think of it as a Cartesian coordinate system). In this coordinate system, a standard unit is 1 km. In this coordinate system, most of the data marked for geographic information is done through purchase. In order to save the cost of data update, Xin Ge in the data group came up with a good idea-test data by yourself.
Xin ge started the experiment according to his expectation. In each group, xin Ge selected three base stations of mobile operators that have been accurately labeled in the coordinate system of Baidu map as signal receiving points (here we can accurately obtain the signal receiving time information ). When the user's mobile phone signs in near the signal receiving point, the three signal receiving points will receive this signal successively, it can accurately know the time when the signal is received (the time when the first signal point receives the signal is recorded as 0 s ). Therefore, we can determine the exact coordinates of the user's mobile phone sign-in location on the map.
The following data is known:
1. Coordinates (x1, Y1), (X2, Y2), (X3, Y3) of the three signal receiving points in the coordinate system of Baidu map );
2. obtain the time when the user sends the signals T1, T2, T3 (T1, T2, T3 ≥ 0) from the three signal points, in the unit of S; T1, T2, T3 at least one number is 0;
3. Signal playback speed C, in MB/s;
Please help Xin Ge writeProgramCalculate the coordinates of the user's signal position in the coordinate system of Baidu map (This point is unique ).

Input
The input contains multiple groups of data. The format of each group is as follows:
C
X1 Y1 X2 Y2 X3 Y3
T1 T2 T3
The last group of data is 0, indicating that the input is complete.
Output
For each group of test data, please first output the group number (group N is the output "Case N:"); then wrap the output signal to output the coordinates of the points (x, y ). X and Y should be separated by spaces and rounded to the sixth digit after the decimal point.
Sample Input
10000 1 1 1 2 10 0.6 1.610000 0 0 1 00.4142135 0 010000 0 1 0 0 2 10 0.414213562373 110000 0 0-1 0 0 110000 0 0 0 1 0 0 0-10 1 010000 0 1 0-1 00 1 010000 0-1 0 1 00 0 11000 0 1 1 00 10 100
Sample output
Case 1:0. 200000 1.000000 case. 000000 1.000000 case. 000000 1.000000 case. 000000-0.500000 case. 000000-0.500000 case 6:-0.500000 0.000000 case 7:-0.500000 0.000000 case. 000000 0.000000

 

 

 

 

# Include <iostream> # Include <Cstdio># Include <Cstring> # Include <Cstdlib> # Include <Cassert> # Include < String > # Include <Algorithm> # Include <Fstream> # Include <Sstream> # Include < Set > # Include <Map> # Include <Vector> # Include <Queue> # Include <Deque> # Include <Complex> # Include <Numeric> Using   Namespace  STD;  Double X [ 10 ], Y [ 10 ], T [ 10  ];  Bool Solve (Int I, Int J, Int  K ){  Double  X1, Y1, X2, Y2, T1, T2; X1 = X [J]- X [I]; x2 = X [k]- X [I]; Y1 = Y [J]- Y [I]; Y2 = Y [k]- Y [I]; T1 = T [J]- T [I]; T2 = T [k]- T [I];  Double A1 = x1 * X1 + Y1 * Y1-T1 * T1;  Double A2 = x2 * X2 + y2 * Y2-T2 * T2;  Double A = A1 * y2-A2 * Y1, B = A1 * x2-A2 * X1, c = A1 * t2-A2 * T1;  Double CITA = Atan2 (B, );  Double Sum = Asin (-C/SQRT (A * A + B * B + 1E- 15  ));  Double Alpha = sum- CITA; Double  R;  If (ABS (A1)> ABS (A2) r = A1/(t1 + X1 * Cos (alpha) + Y1 * sin (alpha ))/ 2  ;  Else  R = A2/(T2 + x2 * Cos (alpha) + y2 * sin (alpha ))/ 2  ;  If (R < 0  ) {Sum =-Sum +3.141592653579  ; Alpha = Sum- CITA;  If (ABS (A1)> ABS (A2) r = A1/(t1 + X1 * Cos (alpha) + Y1 * sin (alpha ))/ 2  ;  Else  R = A2/(T2 + x2 * Cos (alpha) + y2 * sin (alpha ))/ 2  ;} Printf (  "  %. 6f %. 6f \ n " , R * Cos (alpha) + X [I], R * sin (alpha) + Y [I]);}  Int  Main (){  For ( Int Dd = 1 ; ++ Dd ){  Double  C; scanf (  "  % Lf  " ,& C); c /=1000  ;  If (ABS (c) <1E- 6  )  Break  ; Scanf (  "  % Lf  " , X, Y, x + 1 , Y + 1 , X + 2 , Y + 2  ); Scanf ( "  % Lf  " , T, T + 1 , T + 2  ); Printf (  "  Case % d: \ n  "  , DD); t [  0 ] * = C; t [  1 ] * = C; t [  2 ] * =C;  If (Solve ( 0 , 1 , 2  ))  Continue  ;}  Return   0  ;} 

 

 

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.