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 ar array
typedef int64_t ll;
#define int ll
vector<int> res;
void get(int n, int last, int sum){
if(n == 1){
res.push_back(sum);
return;
}
for(int i=1;i * 1ll * i <= n;i++){
if(n % i == 0){
if(i >= last) get(n / i, i, sum + i - 1);
if(n / i >= last) get(i, n / i, sum + (n / i) - 1);
}
}
}
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int n; cin>>n;
get(n, 2, 0);
sort(res.begin(), res.end());
res.erase(unique(res.begin(), res.end()), res.end());
cout<<(int)res.size()<<"\n";
for(auto x : res) 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... |