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> ans;
void call(int f, int curr){
//cout << "Called " << f << " " << curr << "\n";
if(f==1){
ans.insert(curr);
return;
}
for (int i = 2; i<=f; i++){
if(f%i==0){
call(f/i,curr+i-1);
}
}
}
int main(){
int n;cin>>n;
call(n,0);
cout << ans.size();
auto it = ans.begin();
cout << "\n";
while(it!=ans.end()){
cout<<*it << " ";
it++;
}
}
# | 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... |