#SP0000098. Giúp Hanzo đếm vùng an toàn (Help Hanzo)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Giúp Hanzo đếm vùng an toàn (Help Hanzo)
Help Hanzo
Source: LightOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given integers and , count the prime numbers in the closed interval , including both endpoints. A prime is an integer greater than with exactly two distinct positive divisors, and itself; in particular, is not prime. Output only the number of primes, not the list.
Hanzo must cross territories numbered from through . A territory is safe exactly when its number is prime. Count the safe territories he may cross.
Input
One line contains two integers and , the inclusive left and right endpoints of the interval.
Output
Print one integer: the number of primes in the interval.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
2 36
Output
11
Explanation
The prime-numbered territories from to are . There are safe territories, so output . The original Case i: prefix is omitted in this single-instance adaptation.