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 MAX_K = 1e5;
const int MOD = 1e9 + 7;
int dp[MAX_K + 1];
int main() {
int n, k;
cin >> n >> k;
dp[1] = 1;
for ( int i = 2; i <= n; i++ ) {
for ( int j = k; j >= 1; j-- )
dp[j] = ((long long)dp[j] * j + (long long)dp[j - 1] * (i - j + 1)) % MOD;
}
cout << dp[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... |