#CT0000074. Các số có ba ước (Numbers with Exactly Three Divisors)
Bài tập này chưa được xếp vào lộ trình.
Mục lục đề ⌄
Các số có ba ước (Numbers with Exactly Three Divisors)
Numbers with Exactly Three Divisors
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer has exactly three divisors if it has precisely three distinct positive divisors, including and itself.
For example, has the divisors , , and , so it qualifies. The number has four positive divisors and does not qualify.
Given two integers and , count the integers with exactly three divisors in the inclusive interval .
Input
One line containing integers , .
Output
Output one integer: the number of qualifying integers in .
Subtasks
- Subtask 1 (35 points): .
- Subtask 2 (25 points): .
- Subtask 3 (40 points): .
Examples
Example 1
Input
1 50
Output
4
Explanation: The qualifying numbers are 4, 9, 25, and 49 (the squares of 2, 3, 5, and 7).
Example 2
Input
10 100
Output
2
Explanation: In [10,100], only 25 and 49 have exactly three divisors; 4 and 9 are outside.
Example 3
Input
1 1
Output
0
Explanation: The number 1 has only one positive divisor and is not counted.
Liên quan
Trong các cuộc thi sau: