目录
思路
代码
思路
代码
#include <iostream>
#include <algorithm>
using namespace std;
using LL = long long;
const int N = 1e2 + 9;
const int mod = 1e6 + 7;
int n,m;
LL a[N];
LL f[N][N];
void solve()
{
cin >> n >> m;
f[0][0] = 1;
for (int i = 1;i <= n;i ++) cin >> a[i];
for (int i = 1;i <= n;i ++)
for (int j = 0;j <= m;j ++)
for (int k = 0;k <= a[i] && k <= j;k ++)
f[i][j] = (f[i][j] + f[i - 1][j - k]) % mod;
cout << f[n][m] << endl;
}