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;
unordered_set < int > st;
void cnt(int n,int sum,int mx)
{
st.insert(sum+n-1);
for(int i=2;(i*i<=n && i<=mx);i++)
{
if((n%i)==0)
{
cnt(n/i,sum+i-1,i);
}
}
}
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
int n;
cin>>n;
cnt(n,0,n);
vector < int > ans;
for(auto u:st)
{
ans.push_back(u);
}
sort(ans.begin(),ans.end());
cout<<ans.size()<<"\n";
for(auto u:ans)
{
cout<<u<<" ";
}
cout<<"\n";
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... |