#CCBCHMOT0000059. Căn bậc hai nguyên (Integer Square Root)
Căn bậc hai nguyên (Integer Square Root)
Integer Square Root
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a nonnegative integer , find the greatest nonnegative integer satisfying . This is the integer square root of ; the answer must be exact rather than inferred from floating-point rounding.
Input
One line contains a nonnegative integer .
Output
Print the integer .
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input
26
Output
5
Explanation
while , hence the answer is 5.
Example 2
Input
0
Output
0
Explanation
but , so the answer is zero.
Example 3
Input
1000000000000
Output
1000000
Explanation
, giving the exact integer square root.