#include <bits/stdc++.h>
using namespace std;
int main(){
int n, k; cin >> n >> k;
int mod = 1e9 + 7;
vector<vector<int>> dp(n+1, vector<int>(k+1, 0));
for(int i = 0; i < n+1; i ++){
dp[i][0] = 1;
if(i > 0) for(int j = 1; j < k+1; j ++) dp[i][j] = ((dp[i-1][j-1] * (i - j)) % mod + (dp[i-1][j] * (j + 1)) % mod) % mod;
}
cout << dp[n][k];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |