#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
104 ms |
46732 KB |
Output is correct |
2 |
Correct |
136 ms |
46808 KB |
Output is correct |
3 |
Correct |
114 ms |
46956 KB |
Output is correct |
4 |
Correct |
104 ms |
47068 KB |
Output is correct |
5 |
Correct |
136 ms |
47068 KB |
Output is correct |
6 |
Correct |
131 ms |
47068 KB |
Output is correct |
7 |
Correct |
110 ms |
47068 KB |
Output is correct |
8 |
Correct |
139 ms |
47076 KB |
Output is correct |
9 |
Correct |
110 ms |
47076 KB |
Output is correct |
10 |
Correct |
115 ms |
47076 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
104 ms |
46732 KB |
Output is correct |
2 |
Correct |
136 ms |
46808 KB |
Output is correct |
3 |
Correct |
114 ms |
46956 KB |
Output is correct |
4 |
Correct |
104 ms |
47068 KB |
Output is correct |
5 |
Correct |
136 ms |
47068 KB |
Output is correct |
6 |
Correct |
131 ms |
47068 KB |
Output is correct |
7 |
Correct |
110 ms |
47068 KB |
Output is correct |
8 |
Correct |
139 ms |
47076 KB |
Output is correct |
9 |
Correct |
110 ms |
47076 KB |
Output is correct |
10 |
Correct |
115 ms |
47076 KB |
Output is correct |
11 |
Correct |
125 ms |
47148 KB |
Output is correct |
12 |
Correct |
142 ms |
47148 KB |
Output is correct |
13 |
Correct |
130 ms |
47300 KB |
Output is correct |
14 |
Correct |
108 ms |
47300 KB |
Output is correct |
15 |
Correct |
118 ms |
47300 KB |
Output is correct |
16 |
Correct |
127 ms |
47300 KB |
Output is correct |
17 |
Correct |
108 ms |
47320 KB |
Output is correct |
18 |
Correct |
129 ms |
47320 KB |
Output is correct |
19 |
Correct |
103 ms |
47320 KB |
Output is correct |
20 |
Correct |
100 ms |
47320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
104 ms |
46732 KB |
Output is correct |
2 |
Correct |
136 ms |
46808 KB |
Output is correct |
3 |
Correct |
114 ms |
46956 KB |
Output is correct |
4 |
Correct |
104 ms |
47068 KB |
Output is correct |
5 |
Correct |
136 ms |
47068 KB |
Output is correct |
6 |
Correct |
131 ms |
47068 KB |
Output is correct |
7 |
Correct |
110 ms |
47068 KB |
Output is correct |
8 |
Correct |
139 ms |
47076 KB |
Output is correct |
9 |
Correct |
110 ms |
47076 KB |
Output is correct |
10 |
Correct |
115 ms |
47076 KB |
Output is correct |
11 |
Correct |
125 ms |
47148 KB |
Output is correct |
12 |
Correct |
142 ms |
47148 KB |
Output is correct |
13 |
Correct |
130 ms |
47300 KB |
Output is correct |
14 |
Correct |
108 ms |
47300 KB |
Output is correct |
15 |
Correct |
118 ms |
47300 KB |
Output is correct |
16 |
Correct |
127 ms |
47300 KB |
Output is correct |
17 |
Correct |
108 ms |
47320 KB |
Output is correct |
18 |
Correct |
129 ms |
47320 KB |
Output is correct |
19 |
Correct |
103 ms |
47320 KB |
Output is correct |
20 |
Correct |
100 ms |
47320 KB |
Output is correct |
21 |
Correct |
124 ms |
47320 KB |
Output is correct |
22 |
Correct |
129 ms |
47320 KB |
Output is correct |
23 |
Correct |
100 ms |
47320 KB |
Output is correct |
24 |
Correct |
108 ms |
47320 KB |
Output is correct |
25 |
Correct |
130 ms |
47320 KB |
Output is correct |
26 |
Correct |
118 ms |
47320 KB |
Output is correct |
27 |
Correct |
135 ms |
47320 KB |
Output is correct |
28 |
Correct |
147 ms |
47320 KB |
Output is correct |
29 |
Correct |
144 ms |
47320 KB |
Output is correct |
30 |
Correct |
124 ms |
47320 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
104 ms |
46732 KB |
Output is correct |
2 |
Correct |
136 ms |
46808 KB |
Output is correct |
3 |
Correct |
114 ms |
46956 KB |
Output is correct |
4 |
Correct |
104 ms |
47068 KB |
Output is correct |
5 |
Correct |
136 ms |
47068 KB |
Output is correct |
6 |
Correct |
131 ms |
47068 KB |
Output is correct |
7 |
Correct |
110 ms |
47068 KB |
Output is correct |
8 |
Correct |
139 ms |
47076 KB |
Output is correct |
9 |
Correct |
110 ms |
47076 KB |
Output is correct |
10 |
Correct |
115 ms |
47076 KB |
Output is correct |
11 |
Correct |
125 ms |
47148 KB |
Output is correct |
12 |
Correct |
142 ms |
47148 KB |
Output is correct |
13 |
Correct |
130 ms |
47300 KB |
Output is correct |
14 |
Correct |
108 ms |
47300 KB |
Output is correct |
15 |
Correct |
118 ms |
47300 KB |
Output is correct |
16 |
Correct |
127 ms |
47300 KB |
Output is correct |
17 |
Correct |
108 ms |
47320 KB |
Output is correct |
18 |
Correct |
129 ms |
47320 KB |
Output is correct |
19 |
Correct |
103 ms |
47320 KB |
Output is correct |
20 |
Correct |
100 ms |
47320 KB |
Output is correct |
21 |
Correct |
124 ms |
47320 KB |
Output is correct |
22 |
Correct |
129 ms |
47320 KB |
Output is correct |
23 |
Correct |
100 ms |
47320 KB |
Output is correct |
24 |
Correct |
108 ms |
47320 KB |
Output is correct |
25 |
Correct |
130 ms |
47320 KB |
Output is correct |
26 |
Correct |
118 ms |
47320 KB |
Output is correct |
27 |
Correct |
135 ms |
47320 KB |
Output is correct |
28 |
Correct |
147 ms |
47320 KB |
Output is correct |
29 |
Correct |
144 ms |
47320 KB |
Output is correct |
30 |
Correct |
124 ms |
47320 KB |
Output is correct |
31 |
Runtime error |
221 ms |
93652 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
32 |
Halted |
0 ms |
0 KB |
- |