package lanqiaobei;
import java.util.Scanner;
/*
习题:杨辉三角
杨辉三角是二项式系数在三角形中的一种几何排列。它的每个数等于它上方两数之和,每行数字左右对称,由1 开始逐渐变大。
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
请求出杨辉三角的第 n 行,第m 项的数字是什么。
输入格式
第一行输入两个整数 n,m代表行数和列数。(1≤n,m≤50)
输出格式
输出一个整数,代表杨辉三角的第 n 行,第 m 项的数字。
样例输入
6 3
样例输出
10
*/
public class YangHuiSanJiao_DTGH {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[][] dp=new int[n][n];
dp[0][0]=1;
for (int i = 1; i <n ; i++) {
for (int j = 0; j <=i ; j++) {
if (j==0||j==i) dp[i][j]=1;
else dp[i][j]=dp[i-1][j]+dp[i-1][j-1];
}
}
System.out.println(dp[n-1][m-1]);
}
}