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;
int n;
set<int> solve(int mn, int vl)
{
set<int> t;
for (int i=mn; (i+1)*(i+1)<=vl; i++)
{
if ((vl%(i+1))!=0) continue;
set<int> a=solve(i, vl/(i+1));
for (auto x:a) t.insert(x+i);
}
t.insert(vl-1);
return t;
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
auto tmp=solve(1, n);
cout<<tmp.size()<<'\n';
for (auto x:tmp) cout<<x<<' ';
}
# | 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... |