This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
بسم الله الرحمن الرحيم
Author:
(:Muhammad Aneeq:)
*/
#include <iostream>
#include <cmath>
#include <set>
using namespace std;
set<int> divsum(int n)
{
set<int>ans;
ans.insert(n-1);
for (int i=2;i<=sqrt(n);i++)
{
if (n%i==0)
{
set<int>y=divsum(n/i);
for (auto j:y)
ans.insert(i-1+j);
}
}
return ans;
}
inline void solve()
{
int n;
cin>>n;
set<int>ans=divsum(n);
cout<<ans.size()<<endl;
for (auto i:ans)
cout<<i<<' ';
cout<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
solve();
}
# | 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... |