Moving Towards a Point
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Problem Statement
You are currently at the origin in a two-dimensional plane and you need to move a distance of unit towards the point . Your task is to find your coordinates after the move.
Here, moving a distance from a point to a point ( length of the segment ), places you at the point on the segment whose distance from is . The constraints guarantee that the distance between the points and is at least .
INPUT FORMAT (input arrives from the terminal / stdin):
The first line of the input contains two integers and , the coordinates of the point you are moving towards. It is guaranteed that .
OUTPUT FORMAT (print output to the terminal / stdout):
Print two numbers and , your coordinates after the move. They should be printed 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 .
SAMPLE INPUT 1:
3 4
SAMPLE OUTPUT 1:
0.600000000000 0.800000000000
If you print 0.5999999999 0.8000000001
, for example, would also be accepted.
SAMPLE INPUT 2:
246 402
SAMPLE OUTPUT 2:
0.521964870245 0.852966983083
If you print 0.5999999999 0.8000000001
, for example, would also be accepted.
SCORING:
- For all inputs:
HFI Coding Club 2023 November Contest
- Status
- Done
- Rule
- IOI
- Problem
- 4
- Start at
- 2023-11-16 18:45
- End at
- 2023-11-16 20:45
- Duration
- 2 hour(s)
- Host
- Partic.
- 21