PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000053. Bài toán Noldbach (Noldbach Problem)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Bài toán Noldbach (Noldbach Problem)
Noldbach Problem
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Two primes are called consecutive primes if no other prime lies strictly between them. A prime qualifies if for some consecutive primes . Given , determine whether there are at least distinct qualifying primes in .
Input
One line containing integers and .
Output
Print YES if at least qualifying primes exist; otherwise print NO.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
27 2
Output
YES
Explanation
The consecutive-prime pairs and produce and . Both are primes at most , providing at least two qualifying primes, so print YES.