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.
|
|
|
|
#include<bits/stdc++.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
֪ʶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD>Ϊsum<EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
<EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲο<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
https://www.cnblogs.com/aiguona/p/9218754.html
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
int n, sum;
|
|
|
|
|
cin >> n >> sum;
|
|
|
|
|
|
|
|
|
|
vector<long long> a(sum + 1);
|
|
|
|
|
vector<int> b(n);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < n; i++)
|
|
|
|
|
cin >> b[i];
|
|
|
|
|
|
|
|
|
|
a[0] = 1;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < n; i++)
|
|
|
|
|
for (int j = sum; j >= b[i]; j--)
|
|
|
|
|
a[j] += a[j - b[i]];
|
|
|
|
|
|
|
|
|
|
cout << a[sum] << endl;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|