PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000141. Bộ ba nguyên tố cùng nhau của Dora (Dora's Set)
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ộ ba nguyên tố cùng nhau của Dora (Dora's Set)
Dora's Set
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Initially the set contains every integer in the interval . In one operation, select three distinct remaining integers that are pairwise coprime:
Remove all three selected integers from . Find the maximum number of operations.
Input
One line contains integers .
Output
Print the maximum number of operations.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
10 21
Output
3
Explanation
The interval contains six odd integers: . Three operations are possible using , , and . Each triple is pairwise coprime. Every operation needs at least two odd numbers, so six odds allow at most three operations. The answer is 3.