This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
vector <int> ans;
void solve(int n, int sum = 0) {
if(n == 1) {
ans.push_back(sum);
}
for(int i = 2; i <= n; i++) {
if(n % i == 0) {
solve(n / i, sum + i - 1);
}
}
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int N;
cin >> N;
solve(N);
ans.push_back(N - 1);
sort(ans.begin(), ans.end());
ans.resize(unique(ans.begin(), ans.end()) - ans.begin());
cout << ans.size() << '\n';
for(auto v : ans) {
cout << v << ' ';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |