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;
set<int> s;
void rec(int n,int sm){
if(n == 1){
s.insert(sm);
return;
}
for(int i = 1;i*i<=n;i++){
if(n%i) continue;
if(i>1) rec(n/i,sm+i-1);
int x = n/i;
rec(n/x,sm+x-1);
}
}
int main(){
ios_base::sync_with_stdio(false);
int n;
cin>>n;
rec(n,0);
cout<<s.size()<<endl;
set<int>::iterator it = s.begin();
for(;it!=s.end();it++){
cout<<*(it)<<endl;
}
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... |