PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000108. ƯCLN lớn nhất của dãy tăng (Maximal GCD)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
ƯCLN lớn nhất của dãy tăng (Maximal GCD)
Maximal GCD
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive integers , construct a strictly increasing sequence of positive integers with sum and the maximum possible GCD of all elements. Print -1 if no sequence exists. Any optimal sequence is accepted.
Input
One line containing .
Output
Print -1 if impossible; otherwise print exactly elements.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
8 2
Output
2 6
Explanation
The sequence sums to and has GCD , which is optimal.