CF2275A.In Search of Convenience

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

K1o0n got a router and placed it at point (x0,y0)(x_0, y_0); 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 RR 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 RR from the router. For example, if the router is at point (5,5)(5, 5) and R=5R = 5, then the desk can be placed at point (2,1)(2,1), because (5−2)2+(5−1)2=52(5 - 2)^2 + (5 - 1)^2 = 5^2.

Find any point with integer coordinates that is exactly RR away from (x0,y0)(x_0, y_0).

Recall that the distance from the point (x0,y0)(x_0, y_0) to the point (x,y)(x, y) is (x0−x)2+(y0−y)2\sqrt{(x_0 - x)^2 + (y_0 - y)^2}.

K1o0n 得到了一台路由器,并将其放置在点 (x0,y0)(x_0, y_0) 处;我们将公寓的平面布局视为一个坐标平面,且地面铺有方砖,因此家具只能摆放在整数坐标的格点上。

网络信号恰好覆盖路由器周围 RR 米的范围。K1o0n 希望将他的电脑尽可能远离路由器——但仍需保证能接收到网络信号。因此,放置电脑的书桌必须恰好位于信号覆盖边界的某一点上,即该点到路由器的距离恰好为 RR。例如,若路由器位于点 (5,5)(5, 5),且 R=5R = 5,则书桌可放置在点 (2,1)(2,1),因为 (5−2)2+(5−1)2=52(5 - 2)^2 + (5 - 1)^2 = 5^2。

请找出任意一个整数坐标点 (x,y)(x, y),使其到 (x0,y0)(x_0, y_0) 的距离恰好为 RR。

注意:点 (x0,y0)(x_0, y_0) 到点 (x,y)(x, y) 的距离为 (x0−x)2+(y0−y)2\sqrt{(x_0 - x)^2 + (y_0 - y)^2}。

输入格式

The first line contains an integer tt (1≤t≤1041 \le t \le 10^4) — the number of testcases.

The only line of each testcase contains three integers x0x_0, y0y_0, and RR (−10≤x0,y0≤10-10 \le x_0, y_0 \le 10, 1≤R≤251 \le R \le 25) — the coordinates of the router and the coverage radius.

第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4)——测试用例的数量。

每个测试用例仅有一行,包含三个整数 x0x_0、y0y_0 和 RR(−10≤x0,y0≤10-10 \le x_0, y_0 \le 10,1≤R≤251 \le R \le 25)——路由器的坐标及其覆盖半径。

输出格式

For each testcase, output two integers xx and yy — the coordinates of the desk.

If there are several suitable points, output any of them.

对于每个测试用例,输出两个整数 xx 和 yy —— 课桌的坐标。

如果存在多个符合条件的点,输出其中任意一个即可。

输入输出样例

  • 输入#1

    3
    0 0 1
    5 5 5
    10 10 13

    输出#1

    0 1
    2 1
    -2 5

说明/提示

null

输入解题思路,AI测评打分。不知道怎么写?

首页