# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
128202 | TadijaSebez | Toys (CEOI18_toy) | C++11 | 509 ms | 16976 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;
void Solve(int sum, int ost, int last)
{
ans.push_back(sum+ost-1);
for(int i=last;i*i<=ost;i++)
{
if(ost%i==0)
{
Solve(sum+i-1,ost/i,i);
}
}
}
int main()
{
scanf("%i",&n);
Solve(0,n,2);
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... |