Treasure Hunt
Time limit1sMemory limit128 MB
Given a and b, find the shared limit of the arithmetic and harmonic mean iteration, which is sqrt(a b), printed to three decimals.
- Level
Medium7 of 10
- Topics
- Math, Binary search
- Solved
- No attempts yet
Problem
On the way to school, Heehyun picked up a treasure map. The map said this.
- Let the coordinates of the school's main gate be .
- and . ()
- ,
- Keep following the trail and the treasure turns up!
The two sequences and converge to one and the same value. That value is both the coordinate and the coordinate of the treasure. Help Heehyun and find where the treasure is.
Input
The first line contains two positive integers and , separated by a space. ()
Output
Print the coordinate and the coordinate of the treasure on the first line, separated by a space.
Round both coordinates at the fourth digit after the decimal point and print exactly three digits after the decimal point. Keep trailing zeros. If the answer is the integer , write it as 6.000.