#CCBCHBA0000126. Đếm số nguyên tố trong [L,R] (Count Primes in an Interval)
Đếm số nguyên tố trong [L,R] (Count Primes in an Interval)
Count Primes in an Interval
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given , count primes in the inclusive interval . A prime is an integer greater than 1 with exactly two positive divisors. Neither 0 nor 1 is prime. Use direct trial division; a sieve or array is unnecessary.
Input
One line contains integers .
Output
Print the number of primes in the inclusive interval.
Subtasks
-
Subtask 1 (20%): .
-
Subtask 2 (30%): .
-
Subtask 3 (50%): .
Examples
Example 1
Input:
0 10
Output:
4
Explanation:
Count only numbers at least 2 with no divisor up to their square root.
Example 2
Input:
1 1
Output:
0
Explanation:
Count only numbers at least 2 with no divisor up to their square root.