1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <cstdio> #include <cstring> #include <algorithm> #include <cstdlib> #include <string> #include <vector> using namespace std;
typedef long long LL; const int maxn = 10010; LL dp[maxn];
int main() { freopen("money.in", "r", stdin); freopen("money.out", "w", stdout); int v, n; scanf("%d%d", &v, &n); dp[0] = 1; while (v--) { int x; scanf("%d", &x); for (int i = x; i <= n; ++i) { dp[i] += dp[i - x]; } } printf("%lld\n", dp[n]); return 0; }
|