#include<iostream>
using namespace std;
long long d[3002][3002], n, m;
long long mod = 1000000007;
int main()
{
cin >> n >> m;
for (int i = 1; i <= n; i++)
{
d[i][0] = 1;
d[i][1] = i*(i - 1) / 2 + 4 * i + 1;
}
for (int i = 1; i <= m; i++)
{
d[0][i] = 1;
d[1][i] = i*(i - 1) / 2 + 4 * i + 1;
}
cout << 11 << endl;
for (long long i = 2; i <= n; i++)
{
for (long long j = 2; j <= m; j++)
{
d[i][j] = ((i*(i - 1) / 2) * d[i - 2][j - 1] + i * 4 * d[i - 1][j - 1] + i*(j - 1)*d[i - 1][j - 2] + d[i][j - 1]) % mod;
}
}
cout << (d[n][m] - 1 + mod) % mod << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |