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<iostream>
#include<bits/stdc++.h>
using namespace std;
int sum{0};
set<int> s;
void factor(int n,int div )
{
if(n==1)s.insert(sum);
else
{
for(int k = max(div,2) ; k<=n ; k++)
{
if(n%k == 0)
{
sum = sum +k-1;
factor(n/k , k);
sum = sum -k+1;
}
}
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
factor(t,1);
cout<<s.size()<<endl;
for( auto t = s.begin() ; t != s.end();t++)
{
cout<<*t<<" ";
}
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... |