# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
579178 | | web | Toys (CEOI18_toy) | C++17 | | 1707 ms | 4388 KiB |
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, long long maxN)
{
if(n==1)
{
numToys.insert(numUsedAlready);
return;
}
if(n>1)
numToys.insert(numUsedAlready+(n-1));
for(int i = 1; i<=min(maxN,static_cast<long long>(ceil(sqrt(n))));++i)
{
if(n%(i+1) == 0)
{
recursiveCalc( n/(i+1), numUsedAlready + i, i);
}
}
}
int main()
{
long long n;
cin>>n;
recursiveCalc( n, 0, n+1);
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... |