文章
68
粉丝
691
获赞
26
访问
578.3k
https://blog.csdn.net/csyifanZhang/article/details/106054458
↑地址
#define MAX 25
#define inf 0x3fffff
#define ll long long
#define vec vector<ll>
#define PA pair<ll,ll>
int main() {
ll n, k, dp[MAX][MAX]; cin >> n >> k;
memset(dp, 0, sizeof(dp));
for (int i = 1; i <= n; i++)dp[i][1] = dp[i][i] = 1;
for (int i = 3; i <= n; i++)
for (int j = 2; j < i; j++)
dp[i][j] = (i - j + 1)*dp[i - 1][j - 1] + j * dp[i - 1][j];
cout << dp[n][k] << endl;
}
登录后发布评论
暂无评论,来抢沙发