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>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
ll dp[3001][3001];
int main() {
cin.tie(0)->sync_with_stdio(0);
int n, k;
cin >> n >> k;
dp[1][1] = 1;
for (int i = 2; i <= n; i++) for (int j = 1; j <= i; j++)
dp[i][j] = (dp[i - 1][j] * j + dp[i - 1][j - 1] * (i - j + 1)) % MOD;
cout << dp[n][k];
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... |