PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000154. Bộ câu hỏi chia hết tối ưu (Vasya and Petya's Game)
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ộ câu hỏi chia hết tối ưu (Vasya and Petya's Game)
Vasya and Petya's Game
Source: Codeforces 576A
Version: Phuoc Hung OJ Extended — one dataset per judge run.
Problem Statement
An unknown integer belongs to . You may ask divisibility questions for chosen values , all at once. Output a minimum-size set of questions that uniquely determines every possible . Any optimal set is accepted.
Input
One line containing the integer .
Output
Print the minimum number of questions, followed by distinct values in . Any order is accepted.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Example
Input
4
Output
3
2 4 3
Explanation
The three questions distinguish all possibilities . No set of two questions suffices.