You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
489 B

#include <bits/stdc++.h>
using namespace std;
const int N = 110, mod = 1000007;
int n, m;
int f[N];
int main() {
cin >> n >> m;
f[0] = 1; // 求方案数的base case
for (int i = 1; i <= n; i++) {
int a;
cin >> a; // 最多允许选a个
for (int j = m; j >= 0; j--)
for (int k = 1; k <= min(a, j); k++)
f[j] = (f[j] + f[j - k]) % mod;
}
cout << f[m] << endl;
return 0;
}