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;
using ll = long long;
const ll MOD = (ll)1e9+7;
ll n,k,d[3010][3010];
int main(){
cin >> n >> k; d[1][1] = 1;
for(int i = 2; i <= n; i++)
for(int j = 1; j <= k; j++)
d[i][j] = (d[i-1][j-1]*(i-j+1)+d[i-1][j]*j)%MOD;
cout << d[n][k] << "\n";
}
# | 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... |