Arif is estimating how many square display cases (of side length s) fit under a shelf of a given area N, and needs floor(sqrt(N)) computed without any built-in square-root function. Read a non-negative integer N. Print floor(sqrt(N)) without using any built-in sqrt function — use binary search on the answer.
Input
One integer N.
Output
floor(sqrt(N)).
Constraints
0 ≤ N ≤ 10^18
Sample Input
10
Sample Output
3
main.c
Loading editor…
Write C, then Run (custom I/O) or Submit (sample tests). ⌘/Ctrl+Enter submits.