Pagini recente » Cod sursa (job #837613) | Cod sursa (job #1395473) | Cod sursa (job #1352348) | Cod sursa (job #68257) | Cod sursa (job #2528676)
#include <bits/stdc++.h>
using namespace std;
const int DIM = 5e4 + 5;
vector<int> prm;
int fth[DIM];
bool oki[DIM];
double dp[DIM];
int main(void) {
freopen("nummst.in", "r", stdin);
freopen("nummst.out", "w", stdout);
int n; cin >> n;
int vl = 0;
for (int i = 2; i <= n && !vl; ++i)
if (n % i == 0)
vl = i;
for (int i = 2; i < vl; ++i) if (!oki[i]) {
prm.push_back(i);
for (int j = i + i; j <= vl; j += i)
oki[j] = true;
}
for (int i = 1; i <= vl; ++i)
fth[i] = 1;
for (int x : prm) {
for (int i = vl; i >= 0; --i) {
for (long long y = x; y + i <= vl; y *= x) {
if (dp[i + y] < dp[i] + log(1.0 * y)) {
dp[i + y] = dp[i] + log(1.0 * y);
fth[i + y] = y;
}
}
}
}
vector<int> ans;
for (int i = vl; i; i -= fth[i])
ans.push_back(fth[i] * (n / vl));
sort(ans.begin(), ans.end());
for (int x : ans)
cout << x << " ";
return 0;
}