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;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(11);
cerr << fixed << setprecision(6);
int n;
cin >> n;
set<int> answer;
function<void(int, int, int)> Dfs = [&](int sum, int rem, int lst) {
answer.insert(sum + rem - 1);
for (int i = lst; i * i <= rem; i++) {
if (rem % i != 0) continue;
Dfs(sum + i - 1, rem / i, i);
}
};
Dfs(0, n, 2);
cout << answer.size() << "\n";
for (int c : answer)
cout << c << " ";
}
# | 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... |