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 sum, int n, int last){
ans.push_back(sum + n - 1);
for(int i = last; i * i <= n; ++i)
if(n % i == 0)
solve(sum + i - 1, n / i, i);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
solve(0, 2, 2);
ans.resize(unique(ans.begin(), ans.end()) - ans.begin());
cout << ans.size() << "\n";
for(int x: ans)
cout << x << " ";
cout << "\n";
}
# | 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... |