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;
#define pb push_back
vector <int> ans;
void bkt (int n, int sum, int d) {
ans.pb (sum + n - 1);
for (int i = d; i * i <= n; i++)
if (n % i == 0)
bkt (n / i, sum + i - 1, i);
}
int main() {
int n;
cin >> n;
bkt (n, 0, 2);
sort (ans.begin (), ans.end ());
ans.erase (unique (ans.begin (), ans.end ()), ans.end ());
cout << ans.size () << "\n";
for (auto x : ans)
cout << x << " ";
cout << "\n";
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... |