栈
#include<cstdio> using namespace std; int n,f[18][18]; int main() { scanf("%d",&n); for(int i=0;i<=n;i++){ for(int j=0;j<=n-i;j++){ if(!i)f[i][j]=1; else if(!j)f[i][j]=f[i-1][1]; else f[i][j]=f[i-1][j+1]+f[i][j-1]; } }printf("%d\n",f[n][0]); return 0; } /* Sample input: 3 Sample output: 5 in1: 1 out1: 1 in2: 3 out2: 5 in3: 9 out3: 4892 in4: 15 out4: 9694845 in5: 18 out5: 477638700 */