#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;
ll pw(ll k, ll n)
{
ll total = 1;
for(; n; n >>= 1)
{
if(n & 1)total = total * k % mod;
k = k * k % mod;
}
return total;
}
template<typename T>
void read(T&x)
{
bool Neg=false;
char c;
for(c= getchar();c<'0'||c>'9';c=getchar())
if(c=='-') Neg =!Neg;
x = c-'0';
for (c=getchar();c>='0'&&c<='9';c=getchar())
x=x*10+c-'0';
if(Neg&&x>0) x=-x;
}
ll findp(ll u)
{
return lab[u] < 0 ? u : lab[u] = findp(lab[u]);
}
bool hop(ll u, ll v)
{
u = findp(u);
v = findp(v);
if(u == v)return false;
if(lab[u] > lab[v])swap(u, v);
lab[u] += lab[v];
lab[v] = u;
return true;
}
string s;
void dfs(ll u, ll p)
{
d[u] = ++t;
for(ll i : adj[u])
{
ll v = a[i] + b[i] - u;
if(v == p)continue;
c[v] = i;
P[v][0] = u;
h[v] = h[u] + 1;
for(int i = 1; i <= 18; i ++)P[v][i] = P[P[v][i-1]][i-1];
dfs(v, u);
}
}
set<ll> st;
ll cal(ll n, ll lst, ll sum)
{
if(n >= lst)st.insert(sum+n-1);
for(int i = 2; i <= n / i; i ++)
{
if(n % i == 0)
{
if(i >= lst)cal(n/i, i, sum+i-1);
if(i * i != n && n / i >= lst)cal(i, n/i, sum+n/i-1);
}
}
}
void sol()
{
cin >> n;
cal(n, 2, 0);
cout << st.size() << '\n';
for(ll x : st)cout << x <<" ";
}
int main()
{
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
#define task "testss"
if(fopen(task".inp", "r"))
{
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
int ntest = 1;
//cin >> ntest;
while(ntest -- > 0)
sol();
}
/*
10 4
5 4 3 2 -1 0 0 0 0 0
*/
Compilation message
toy.cpp: In function 'long long int cal(long long int, long long int, long long int)':
toy.cpp:80:1: warning: no return statement in function returning non-void [-Wreturn-type]
80 | }
| ^
toy.cpp: In function 'int main()':
toy.cpp:96:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
96 | freopen(task".inp", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
toy.cpp:97:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
97 | freopen(task".out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5030 ms |
4940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5030 ms |
4940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5030 ms |
4940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5030 ms |
4940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5030 ms |
4940 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |