PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000085. Chia N thành K số với BCNN nhỏ (k-LCM (hard version))
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Chia N thành K số với BCNN nhỏ (k-LCM (hard version))
k-LCM (hard version)
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive integers and , construct exactly positive integers summing to and with LCM at most . A valid construction is always possible; output any valid one. This Phuoc Hung OJ single-instance version limits the number of printed integers to .
Input
One line containing and .
Output
Print exactly positive integers separated by spaces, summing to and having LCM at most .
Subtasks
-
Subtask 1 (20 points): , .
-
Subtask 2 (30 points): , .
-
Subtask 3 (50 points): , .
Examples
Input
9 5
Output
1 1 1 3 3
Explanation
There are exactly five positive numbers summing to . Their LCM is , satisfying .