# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
128193 | TadijaSebez | Toys (CEOI18_toy) | C++11 | 2 ms | 380 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;
vector<int> ans;
int n;
int po(int x, int y)
{
if(y==2) return x*x;
if(y==3) return x*x*x;
if(y==4) return x*x*x*x;
}
void Solve(int sz, int sum, int ost, int last)
{
if(sz==1)
{
sum+=ost-1;
ans.push_back(sum);
return;
}
for(int i=1;po(i,sz)<=ost;i++)
{
if(ost%i==0)
{
Solve(sz-1,sum+i-1,ost/i,i);
}
}
}
int main()
{
scanf("%i",&n);
Solve(4,0,n,1);
sort(ans.begin(),ans.end());
ans.resize(unique(ans.begin(),ans.end())-ans.begin());
printf("%i\n",ans.size());
for(int x:ans) printf("%i ",x);
printf("\n");
return 0;
}
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... |