PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000044. Tìm số nguyên tố (Prime Numbers in a Range)
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ố (Prime Numbers in a Range)
Prime Numbers in a Range
Source: VNOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Two integers determine an inclusive range . Output every prime in this range in ascending order. A prime must be greater than and have no positive divisors other than and itself.
Input
One line containing two integers and .
Output
Print each prime in on its own line in increasing order.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
1 10
Output
2
3
5
7
Explanation
The integers from to include exactly four primes: . Since each is printed on its own line, the output consists of four lines.