PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000043. Tìm số nguyên tố trên đoạn (Primes in an Interval)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tìm số nguyên tố trên đoạn (Primes in an Interval)
Primes in an Interval
Source: LQDOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given integers , find all primes in the inclusive interval . Print the prime numbers in increasing order, one per line.
Input
One line containing two space-separated integers and .
Output
Print the primes in , one per line, in increasing order. Print no numbers if none exist.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
1 10
Output
2
3
5
7
Explanation
Within , only are prime. The number is not prime, while are composite. Hence there are four output lines.