PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000083. Căn bậc hai nguyên (Sqrt(x))
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Căn bậc hai nguyên (Sqrt(x))
Sqrt(x)
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
Given a nonnegative integer , find the largest nonnegative integer with , without using built-in square-root or power functions.
Input
A single line contains .
Output
Print .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
8
Output
2
Explanation
while . Therefore the integer square root is .