B - Get Closer 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 200

問題文

二次元平面上の点 (0,0) から点 (A,B) に向かって距離 1 だけ移動します。移動後の座標を求めてください。

ただし、点 X から点 Y に向かって距離 d (\le 線分 XY の長さ) だけ移動すると、線分 XY 上で点 X からの距離が d であるような点に辿りつくものとします。
なお、制約より点 (0,0) と点 (A,B) の距離は 1 以上であることが保証されます。

制約

  • 入力は全て整数
  • 0 \le A,B \le 1000
  • (A,B) \neq (0,0)

入力

入力は以下の形式で標準入力から与えられる。

A B

出力

移動後の点を (x,y) とするとき、 xy をこの順に空白区切りで出力せよ。
なお、各出力について、想定解との絶対誤差または相対誤差が 10^{−6} 以下であれば正解として扱われる。


入力例 1

3 4

出力例 1

0.600000000000 0.800000000000

他にも、例えば 0.5999999999 0.8000000001 という出力も許容されます。


入力例 2

1 0

出力例 2

1.000000000000 0.000000000000

(A,B) に到着する場合もあります。


入力例 3

246 402

出力例 3

0.521964870245 0.852966983083

Score : 200 points

Problem Statement

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

Here, after moving the distance of d from a point X to a point Y (d \le length of the segment XY), we are at the point on the segment XY whose distance from X is d.
The Constraints guarantee that the distance between the points (0, 0) and (A, B) is at least 1.

Constraints

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

Input

Input is given from Standard Input in the following format:

A B

Output

Let (x, y) be our coordinates after the move. Print x and y 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 10^{−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).


Sample Input 3

246 402

Sample Output 3

0.521964870245 0.852966983083