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 <set>
using namespace std;
set <int> sol;
void solve(int n, int x, int l)
{
if(n == 1)
{
sol.insert(x);
return;
}
for(int a = 1; a * a <= n; a++)
{
if(n % a == 0)
{
if(a >= l)
solve(n / a, x + a - 1, a);
if(n / a >= l)
solve(a, x + n / a - 1, n / a);
}
}
}
int main()
{
int n;
cin >> n;
solve(n, 0, 2);
cout << sol.size() << '\n';
for(int x : sol)
cout << x << " ";
cout << '\n';
}
# | 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... |