一看就是什么正经的题目,乱搞就完事了。
输出的规模应该是 \(\sqrt{N}\) 级别的,否则也不会让输出。
分析一下,每种玩具有 \(c_i\) 个,那么可以玩 \(\prod (c_i+1)\) 天。
所以写个暴搜就行了。状态 \((n,\ last,\ sum)\) 表示剩下的数乘积为 \(n\),上一个数是 \(last\),当前数之和为 \(sum\)。
避免过多重复,我们记录 \(last\) 使得每次选的数比上次的数更大。
/*
Author : SharpnessV
Right Output ! & Accepted !
*/
#include<bits/stdc++.h>
//#define int long long
#define rep(i, a, b) for(int i = (a);i <= (b);i++)
#define pre(i, a, b) for(int i = (a);i >= (b);i--)
#define rp(i, a) for(int i = 1; i <= (a); i++)
#define pr(i, a) for(int i = (a); i >= 1; i--)
#define go(i, x) for(auto i : x)
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ze(p) memset(p, 0, sizeof(p))
#define mem(p, x) memset(p, x, sizeof(p))
#define YES puts("YES")
#define NO puts("NO")
#define si(x) (int)(x).size()
#define db cerr
#define pc putchar
#define el putchar('\n')
using namespace std;
const double eps = 1e-15, pi = 3.1415926535897932385;
typedef long long LL;
typedef pair<int,int> Pr;
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}, inf = 0x7fffffff;
//char buf[1<<22],*p1=buf,*p2=buf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline int read(){
int x = 0;bool f = 1;char ch = getchar();
while(!isdigit(ch))f = ('-' == ch ? 0 : 1), ch = getchar();
while(isdigit(ch))x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
if(f)return x;return -x;
}
inline LL Read(){
LL x = 0;bool f = 1;char ch = getchar();
while(!isdigit(ch))f = ('-' == ch ? 0 : 1), ch = getchar();
while(isdigit(ch))x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
if(f)return x;return -x;
}
int gcd(int x,int y){return y ? gcd(y, x % y) : x;}
int lcm(int x,int y){return x / gcd(x, y) * y;}
#define P 1000000007
//#define P 998244353
#define bas 229
inline void ad(int &x, int y){x += y; if(x >= P) x -= P;}
inline void su(int &x, int y){x -= y; if(x < 0) x += P;}
inline void cmn(int &x,int y){if(y < x) x = y;}
inline void cmx(int &x,int y){if(y > x) x = y;}
int Pow(int x, int y){
if(y < 0)return Pow(Pow(x, P - 2), -y);
int now = 1 ;
for(;y;y >>= 1, x = 1LL * x * x % P)if(y & 1) now = 1LL * now * x % P;
return now;
}
vector<int>ans;
void solve(int n, int mn, int sum){
ans.pb(n - 1 + sum);
for(int i = mn;i * i <= n; i++)if(n % i == 0)
solve(n / i, i, sum + i - 1);
}
int main(){
//int T = read();while(T--)solve();
int n = read();
solve(n, 2, 0);
int pre = ~0,cnt = 0;
sort(ans.begin(), ans.end());
go(x, ans)if(x != pre)pre = x, cnt++;
printf("%d\n", cnt);pre = ~0;
go(x, ans)if(x != pre)printf("%d ",pre = x);
el;return 0;
}