# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
711470 | ToroTN | Toys (CEOI18_toy) | C++14 | 1638 ms | 4400 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<bits/stdc++.h>
using namespace std;
#define pb push_back
//solution by PP.....
int n;
set<int> s;
void solve(int num,int sum,int pre)
{
///printf("%d %d %d\n",num,sum,pre);
if(num==1)
{
s.insert(sum);
return;
}
for(int i=1;i*i<=num;i++)
{
if(num%i==0)
{
if(i>=pre&&i!=1)
{
solve(num/i,sum+i-1,i);
}
if(num/i>=pre&&i*i!=num)
{
solve(i,sum+num/i-1,num/i);
}
}
}
}
int main()
{
cin >> n;
solve(n,0,0);
printf("%d\n",s.size());
for(auto it=s.begin();it!=s.end();it++)printf("%d ",*it);
}
Compilation message (stderr)
# | 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... |