#include<stdio.h>
int n,m;
long long int dp[1010][1010];
int mod=1000000007;
int main(){
int i,j;
scanf("%d%d",&n,&m);
for(i=1;i<=m;i++){
dp[1][i]=1;
}
for(j=2;j<=n;j++){
for(i=1;i<=m;i++){
dp[j][i]=dp[j-1][i]*i+dp[j-1][i-1]*(j-i);
dp[j][i]%=mod;
}
}
printf("%lld",dp[n][m]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
9052 KB |
Output is correct |
2 |
Correct |
0 ms |
9052 KB |
Output is correct |
3 |
Correct |
0 ms |
9052 KB |
Output is correct |
4 |
Correct |
0 ms |
9052 KB |
Output is correct |
5 |
Correct |
0 ms |
9052 KB |
Output is correct |
6 |
Correct |
0 ms |
9052 KB |
Output is correct |
7 |
Correct |
7 ms |
9052 KB |
Output is correct |
8 |
Correct |
6 ms |
9052 KB |
Output is correct |
9 |
Correct |
2 ms |
9052 KB |
Output is correct |
10 |
Correct |
4 ms |
9052 KB |
Output is correct |
11 |
Correct |
14 ms |
9052 KB |
Output is correct |
12 |
Correct |
0 ms |
9052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
13 ms |
9048 KB |
Program hung waiting for input |
2 |
Halted |
0 ms |
0 KB |
- |