problem.txt (1536B)
1 A. In Search of Convenience 2 time limit per test1 second 3 memory limit per test256 megabytes 4 K1o0n got a router and placed it at point (x0,y0) 5 ; we will consider the apartment layout as a coordinate plane, and the floor is tiled, so the furniture can stand only at lattice points with integer coordinates. 6 7 The internet spreads exactly R 8 meters around the router. K1o0n wants to move his computer as far away from it as possible — but still so that the internet is available. Therefore, the desk with the computer must be placed exactly on the reception boundary, at a distance of R 9 from the router. For example, if the router is at point (5,5) 10 and R=5 11 , then the desk can be placed at point (2,1) 12 , because (5−2)2+(5−1)2=52 13 . 14 15 Find any point with integer coordinates that is exactly R 16 away from (x0,y0) 17 . 18 19 Recall that the distance from the point (x0,y0) 20 to the point (x,y) 21 is (x0−x)2+(y0−y)2−−−−−−−−−−−−−−−−−√ 22 . 23 24 Input 25 The first line contains an integer t 26 (1≤t≤104 27 ) — the number of testcases. 28 29 The only line of each testcase contains three integers x0 30 , y0 31 , and R 32 (−10≤x0,y0≤10 33 , 1≤R≤25 34 ) — the coordinates of the router and the coverage radius. 35 36 Output 37 For each testcase, output two integers x 38 and y 39 — the coordinates of the desk. 40 41 If there are several suitable points, output any of them. 42 43 --- 44 45 - router at x_0, y_0 46 - internet is R around router 47 - move computer as far as possible 48 49 50 --- 51 52 ex1 53 54 0 0 1 55 56 x_0, y_0, R 57 58 0,1 59 60 --- 61 62 5 5 5 63 64 5,10 65 66 --- 67 68 10 10 13 69 70 10,23