0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

F - Fabricating Sculptures

https://codeforces.com/gym/102428/submission/177271004
This commit is contained in:
Baoshuo Ren 2022-10-21 15:10:08 +08:00
parent ccd6b3afe0
commit b391fc6406
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

36
Gym/102428/F/F.cpp Normal file
View File

@ -0,0 +1,36 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 5e3 + 5;
const int mod = 1e9 + 7;
int m, n, f[N][N], s[N];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> m >> n;
for (int i = m; i <= n; i++) {
f[1][i] = 1;
s[i] = 1;
}
for (int i = 2; i <= m; i++) {
f[i][m] = 1;
s[i + m]++;
for (int j = m + 1; j <= n; j++) {
f[i][j] = (f[i - 1][j] + s[j]) % mod;
s[i + j] = (s[i + j] + f[i][j]) % mod;
}
}
cout << f[m][n] << endl;
return 0;
}