#abc246b. B - Get Closer

B - Get Closer

Score : 200200 points

问题描述

在二维平面上,从点 (0,0)(0,0) 出发,沿向量指向点 (A,B)(A, B) 移动距离为 11。求移动后我们的坐标位置。

这里需要注意的是,从点 XX 向点 YY 移动距离为 dd(其中 dd \le 线段 XYXY 的长度)时,我们将到达线段 XYXY 上距 XX 点距离恰好为 dd 的那个点。

约束条件保证了点 (0,0)(0, 0) 和点 (A,B)(A, B) 之间的距离至少为 11

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

From the point (0,0)(0,0) in a two-dimensional plane, let us move the distance of 11 toward the point (A,B)(A, B). Find our coordinates after the move.

Here, after moving the distance of dd from a point XX to a point YY (dd \le length of the segment XYXY), we are at the point on the segment XYXY whose distance from XX is dd.
The Constraints guarantee that the distance between the points (0,0)(0, 0) and (A,B)(A, B) is at least 11.

Constraints

  • All values in input are integers.
  • 0A,B10000 \le A,B \le 1000
  • (A,B)(0,0)(A,B) \neq (0,0)

Input

Input is given from Standard Input in the following format:

AA BB

Output

Let (x,y)(x, y) be our coordinates after the move. Print xx and yy in this order, separated by a space.
Your output is considered correct when, for each printed value, the absolute or relative error from the judge's answer is at most 10610^{−6}.

Sample Input 1

3 4

Sample Output 1

0.600000000000 0.800000000000

Printing 0.5999999999 0.8000000001, for example, would also be accepted.

Sample Input 2

1 0

Sample Output 2

1.000000000000 0.000000000000

We may arrive at (A,B)(A, B).

Sample Input 3

246 402

Sample Output 3

0.521964870245 0.852966983083

update @ 2024/3/10 10:33:03