PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000279. Các số có đúng bốn ước (Four Divisors)
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ác số có đúng bốn ước (Four Divisors)
Four Divisors
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer is a positive divisor of a positive integer if divides . For example, has six positive divisors: .
Let be the number of integers between and , inclusive, that have exactly four distinct positive divisors. Given , compute .
Input
The only line contains a positive integer .
Output
Print one integer: .
Subtasks
- Subtask 1 (20 points): . Time limit: s.
- Subtask 2 (30 points): . Time limit: s.
- Subtask 3 (50 points): . Time limit: s.
Examples
Example 1
Input
10
Output
3
Explanation
Exactly three numbers qualify: with divisors ; with ; and with . Thus .
Example 2
Input
20
Output
5
Explanation
The qualifying numbers in are . For instance, the divisors of are . There are five qualifying integers.
Example 3
Input
30
Output
9
Explanation
The nine qualifying integers in are . Therefore print 9.