#include #include #include #include using namespace std; int64_t N, X; inline int64_t product(int64_t a, int64_t b){return a + b + a * b;} vector ns, remains; // 分割数 int dfs(int64_t cur, int curi, int N, int64_t last = 1) { if(N == 0) { for(int i = 0; i <= remains.size(); i++) { if(remains[i])return 0; } return 1; } if(curi == ns.size()) { if(cur < last) return 0; return dfs(0, 0, N - 1, cur); } int ret = 0; int t = remains[curi]; for(int i = 0; i <= t; i++) { ret += dfs(cur, curi + 1, N, last); cur = product(cur, ns[curi]); remains[curi]--; } remains[curi] =t ; return ret; } int main() { cin >> N >> X; // 素因数分解(一意性がある) map factors; for(int64_t i = 1; i * i <= X; i++) { while( (X - i) % (i + 1) == 0) { X = (X - i) / (i + 1); factors[i]++; } } if(X >= 1) factors[X]++; for(auto t: factors){ ns.push_back(t.first); remains.push_back(t.second); } cout << dfs(0, 0, N, 1) << endl; }