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;
#define ll long long
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
const int N = 1e5+5;
const long long mod = 1e9+7;
const long double pi = acos(-1);
const int base = 300;
ll k, t;
ll a[N], ans, m, n, b[N], tong, d[N], c[N], lab[N], cnt, h[N], P[N][20];
vector<pll> val[N];
vector<ll> adj[N], res;
string s;
set<ll> st;
void cal(ll n, ll lst, ll sum)
{
st.insert(sum+n-1);
for(int i = lst; i <= n / i; i ++)
{
if(n % i == 0)
{
cal(n/i, i, sum+i-1);
}
}
}
void sol()
{
cin >> n;
cal(n, 2, 0);
cout << st.size() << '\n';
for(ll x : st)cout << x <<" ";
}
int main()
{
sol();
}
# | 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... |