PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000375. Giải phương trình (Equation)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Giải phương trình (Equation)

Equation

Version: Phuoc Hung OJ Extended

PHOJ practice edition. Its constraints, input/output format, examples and judging rules are specified below.

Statement

Given a real number CC, find the nonnegative solution xx of $$x^2+\sqrt{x}=C.$$ A unique solution exists in the specified domain.

Input

One line contains a real number CC with at most 6 decimal places.

Output

Print the root xx as a real number. Absolute error must not exceed 10−610^{-6}. The output token may contain at most 128 characters; in scientific notation, the explicit exponent must be from -1000 to 1000.

Subtasks

  • Subtask 1 (20 points): 1≤C≤1041\le C\le10^4; CC is integral, possibly written with up to 6 decimal places.
  • Subtask 2 (30 points): 1≤C≤1041\le C\le10^4; at most 6 decimal places.
  • Subtask 3 (50 points): 1≤C≤10101\le C\le10^{10}; at most 6 decimal places.

Illustrative examples (not verified as original samples)

Input

2

Output

1.000000000

Explanation

For C=2C=2, take x=1x=1. Its square is 11 and its square root is 11, giving 1+1=21+1=2. Both terms increase on the nonnegative domain, with the square strictly increasing, so there is no other nonnegative solution.

Input

18

Output

4.000000000

Explanation

For C=18C=18, take x=4x=4. Its square is 1616 and its square root is 22, giving 16+2=1816+2=18. Both terms increase on the nonnegative domain, with the square strictly increasing, so there is no other nonnegative solution.

Input

84

Output

9.000000000

Explanation

For C=84C=84, take x=9x=9. Its square is 8181 and its square root is 33, giving 81+3=8481+3=84. Both terms increase on the nonnegative domain, with the square strictly increasing, so there is no other nonnegative solution.