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 <vector>
#include <string>
#include <set>
#include <math.h>
using namespace std;
set<long long> numToys;
void recursiveCalc( long long n, long long numUsedAlready)
{
if(n==1)
{
numToys.insert(numUsedAlready);
return;
}
if(n>1)
numToys.insert(numUsedAlready+(n-1));
for(int i = 1; i<=ceil(sqrt(n));++i)
{
if(n%(i+1) == 0)
{
recursiveCalc( n/(i+1), numUsedAlready + i);
}
}
}
int main()
{
long long n;
cin>>n;
recursiveCalc( n, 0);
cout<<numToys.size()<<endl;
for(auto el:numToys)
cout<<el<<" ";
cout<<endl;
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... |