0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-16 20:05:26 +00:00

T206821 [✗✓OI R1] 铝锤制作

R62441516
This commit is contained in:
Baoshuo Ren 2021-11-13 15:38:42 +08:00 committed by Baoshuo Ren
parent 242a1604d1
commit 42d5617483
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

35
Luogu/T206821/T206821.cpp Normal file
View File

@ -0,0 +1,35 @@
#include <bits/stdc++.h>
using namespace std;
int n, k, s;
vector<int> a, b;
int main() {
cin >> n >> k;
for (int i = 2; i * i <= n; i++) {
while (n % i == 0) {
a.push_back(i);
n /= i;
}
}
if (n > 1) a.push_back(n);
for (int i : a) {
s += i;
b.push_back(i);
}
if (s > k) {
cout << -1 << endl;
exit(0);
}
while (s < k) {
b.push_back(1);
s++;
}
cout << b.size() << endl;
for (int i : b) {
cout << i << ' ';
}
cout << endl;
return 0;
}