This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 1;
typedef long long ll;
int n, k;
ll d[N][N], base = 1e9 + 7;
int main()
{
cin >> n >> k;
for (int i = 1; i <= n; ++i) d[i][0] = 1;
for (int i = 1; i <= n; ++i)
for (int j = 1; j < i; ++j)
d[i][j] = ((i - j)*d[i - 1][j - 1] + (j + 1)*(d[i - 1][j])) % base;
cout << d[n][k - 1];
}
# | 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... |