#include<stdio.h> int a[19][19]={0}; int chazhao(int a2,int a3) { if(a3==0&&a2!=0)return 1; if(a[a2][a3]!=0)return a[a2][a3]; if(a2==0)return a[a2+1][a3-1]=chazhao(a2+1,a3-1); return a[a2][a3]=(chazhao(a2+1,a3-1)+chazhao(a2-1,a3)); } int main() { int n,m,i,j,k; scanf("%d",&n); printf("%d",chazhao(0,n)); }
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)