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