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;
vector<int>ans;
void cmp (int a,vector<int>v,int s )
{
ans.push_back(s+a-1);
for(int m:v) if(a%m == 0) cmp(a/m,v,s+m-1);
}
int main()
{
int n;
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
vector<int>v;
for (int i=2;i*i<=n;i++)
{
if(n%i==0)
{
v.push_back(i);
if(i!=n/i) v.push_back(n/i);
}
}
cmp(n,v,0);
set<int>r;
for (auto i:ans) r.insert(i);
cout<<r.size()<<endl;
for (auto it:r) cout<<it<<' ';
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... |