#include <iostream>
#include <vector>
using namespace std;
typedef long long llong;
const int MAXN = 4e3 + 10;
const llong MOD = 1e9 + 7;
int n, k;
llong dp[MAXN][MAXN];
void read()
{
cin >> n >> k;
}
void solve()
{
dp[1][1] = 1;
for(int i = 2; i <= n; i++)
{
for(int j = 1; j <= i; j++)
{
dp[i][j] = (1LL * dp[i - 1][j] * j % MOD + 1LL * dp[i - 1][j - 1] * (i - j + 1) % MOD) % MOD;
}
}
cout << dp[n][k] << endl;
}
int main()
{
read();
solve();
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |