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>
#define mk make_pair
#define pb push_back
#define fr first
#define sc second
using namespace std;
int n;
vector <int> vec, ans;
set <int> res;
void dfs (int v, vector <int> &vec, int s = 0)
{
ans.pb(s + v - 1);
for (auto to : vec)
{
if (v % to == 0 && v/ to >= to)
dfs(v / to, vec, s + to - 1);
}
}
int main()
{
cin >> n;
for (int i = 2; i * i <= n; i++)
{
if (n % i != 0) continue;
vec.pb(i);
}
dfs(n, vec);
for (auto to : ans)
res.insert(to);
cout << res.size() << endl;
for (auto to : res)
printf("%d ", to);
}
# | 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... |