#CCBOTPBA0000019. Số chính phương nhỏ hơn n (Positive Squares Below N)
Số chính phương nhỏ hơn n (Positive Squares Below N)
Positive Squares Below N
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Count positive integers i satisfying i*i < n. Exclude the square zero and a square equal to n.
Input
A single integer n.
Output
Count of positive perfect squares strictly below n.
Subtasks
-
Subtask 1 (20%):
0 ≤ n ≤ 1000. -
Subtask 2 (30%):
0 ≤ n ≤ 10^8. -
Subtask 3 (50%):
0 ≤ n ≤ 10^12.
Examples
Example 1
Input:
10
Output:
3
Explanation: The qualifying positive squares are 1, 4, and 9.
Example 2
Input:
9
Output:
2
Explanation: The square 9 equals n and must be excluded.
Example 3
Input:
1
Output:
0
Explanation: No positive square is less than one.