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;
typedef long long ll;
set <int> q;
void dfs(int n, int sum, int last){
if(n == 1) q.insert(sum);
for(int i=1; i*i<=n; i++){
if(n%i == 0){
if(i >= last) dfs(n/i, sum+i-1, i);
if(i != n/i && n/i >= last) dfs(i, sum+n/i-1, n/i);
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cout.precision(10);
cout << fixed;
int n;
cin >> n;
dfs(n, 0, 2);
cout << q.size() << "\n";
for(auto c : q) cout << c << " ";
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... |