CF2275A.In Search of Convenience
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
K1o0n got a router and placed it at point (x0,y0); 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.
The internet spreads exactly R 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 from the router. For example, if the router is at point (5,5) and R=5, then the desk can be placed at point (2,1), because (5−2)2+(5−1)2=52.
Find any point with integer coordinates that is exactly R away from (x0,y0).
Recall that the distance from the point (x0,y0) to the point (x,y) is (x0−x)2+(y0−y)2.
K1o0n 得到了一台路由器,并将其放置在点 (x0,y0) 处;我们将公寓的平面布局视为一个坐标平面,且地面铺有方砖,因此家具只能摆放在整数坐标的格点上。
网络信号恰好覆盖路由器周围 R 米的范围。K1o0n 希望将他的电脑尽可能远离路由器——但仍需保证能接收到网络信号。因此,放置电脑的书桌必须恰好位于信号覆盖边界的某一点上,即该点到路由器的距离恰好为 R。例如,若路由器位于点 (5,5),且 R=5,则书桌可放置在点 (2,1),因为 (5−2)2+(5−1)2=52。
请找出任意一个整数坐标点 (x,y),使其到 (x0,y0) 的距离恰好为 R。
注意:点 (x0,y0) 到点 (x,y) 的距离为 (x0−x)2+(y0−y)2。
输入格式
The first line contains an integer t (1≤t≤104) — the number of testcases.
The only line of each testcase contains three integers x0, y0, and R (−10≤x0,y0≤10, 1≤R≤25) — the coordinates of the router and the coverage radius.
第一行包含一个整数 t(1≤t≤104)——测试用例的数量。
每个测试用例仅有一行,包含三个整数 x0、y0 和 R(−10≤x0,y0≤10,1≤R≤25)——路由器的坐标及其覆盖半径。
输出格式
For each testcase, output two integers x and y — the coordinates of the desk.
If there are several suitable points, output any of them.
对于每个测试用例,输出两个整数 x 和 y —— 课桌的坐标。
如果存在多个符合条件的点,输出其中任意一个即可。
输入输出样例
输入#1
3 0 0 1 5 5 5 10 10 13
输出#1
0 1 2 1 -2 5
说明/提示
null
输入解题思路,AI测评打分。不知道怎么写?