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 ff first
#define ss second
#define all(a) a.begin(), a.end()
signed main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n; cin >> n;
vector<int> p;
set<int> ans;
ans.insert(n-1);
for(int len = 2; len <= 33; len++){
function<void(int, int, int)> f=[&](int cur, int have, int sum){
if(have == len){
if(cur == n) ans.insert(sum);
return;
}
if(cur * (1<<(len - have)) > n) return;
for(int x = 2; cur * x <= n; x++){
f(cur*x, have + 1, sum + x - 1);
}
};
f(1, 0, 0);
}
cout << ans.size() << '\n';
for(auto x : ans) cout << x << ' ';
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... |