Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N=1e4+10;
- const int DP_SIZE=1e6;
- int a[N], n;
- int main()
- {
- scanf ("%d", &n);
- for (int i=1;i<=n;i++) scanf ("%d", &a[i]);
- bitset<DP_SIZE> dp;
- dp.set(0);
- for (int i=1;i<=n;i++) dp|=dp<<a[i];
- cout << dp.count();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment