#include <iostream>
#include <string>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#define maxn 55
using namespace std;
int n, m;
long long dp[maxn][maxn];
int main()
{
//freopen("data.in","r",stdin);
ios::sync_with_stdio(false);
cin >> n >> m;
dp[1][1] = 1;
dp[2][1] = 1;
dp[2][2] = 1;
for(int i = 3; i <= n; ++i) {
for(int j = 1; j <= i; ++j) {
if(j == 1 || j == i) {
dp[i][j] = 1;
continue;
}
dp[i][j] = dp[i-1][j-1] + dp[i-1][j];
}
}
cout << dp[n][m] << endl;
return 0;
}
计蒜客 杨辉三角(DP)
猜你喜欢
转载自blog.csdn.net/ccshijtgc/article/details/80893086
今日推荐
周排行