Title Description
A n train carriages are numbered 1,2,3, ..., n. Each car has two motion, push and pop, the arrangement may ask carriages out of the stack of n number of species.
Enter
a number, n (n <= 60000)
outputs
a number n s denotes a carriage arrangement stack may
sample the input
3
Sample output
5
a typical example of the number of Cattleya, but use the prime factorization of factorial (basic arithmetic Theorem) to count, or will T
The vertical factorial prime factorisation, then take off after about the same quality factor, and finally in addition to n + 1
Reference Code:
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 2e5 + 10;
int f[maxn];
int main()
{
int n;
cin >> n;
f[0] = f[1] = 1;
for (int i = 2; i <= n; i++)
for (int j = 0; j < i; j++)
f[i] += f[j] * f[i - j - 1];
cout << f[n];
return 0;
}