#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define sc second
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define pii pair<ll, ll>
#define ull unsigned long long
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll wmod = 998244353;
const ll hashp = 79333;
const ll hashmod = 2234558939;
#define int long long
set <int> st;
void rec(int n, int ans, int x){
if (n == 1){
st.insert(ans);
return;
}
for (int i = 1; i * i <= n; i++){
if (n % i != 0)continue;
if (i >= x)rec(n / i, ans + i - 1, i);
if (n / i >= x)rec(i, ans + n / i - 1, n / i);
}
}
void solve(){
int n;
cin >> n;
rec(n, 0, 2);
cout << st.size() << '\n';
for (auto y : st)cout << y << ' ';
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ll T = 1;
// cin >> T;
while(T--){
solve();
cout << '\n';
}
return 0;
}
# | 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... |