Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <numeric>
  6. #include <set>
  7. #include <map>
  8. #include <queue>
  9. #include <iostream>
  10. #include <sstream>
  11. #include <cstdio>
  12. #include <cmath>
  13. #include <ctime>
  14. #include <cstring>
  15. #include <cctype>
  16. #include <cassert>
  17. #include <limits>
  18. #include <functional>
  19. #include <stack>
  20.  
  21. #define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
  22. #define REPA(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
  23. #if defined(_MSC_VER)||__cplusplus > 199711L
  24. #define AUTO(r,v) auto r = (v)
  25. #else
  26. #define AUTO(r,v) typeof(v) r = (v)
  27. #endif
  28. #define ALL(c) (c).begin() , (c).end()
  29. #define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();++it)
  30. #define LL long long
  31. #define INF 99999999;
  32. #define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
  33. using namespace std;
  34.  
  35. bool dp[102][10000];
  36. int points[100];
  37.  
  38.  
  39. int main(){
  40. QUICK_CIN;
  41.  
  42. dp[0][0] = true;
  43.  
  44. int n;
  45. cin >> n;
  46. REP(i, n){
  47. cin >> points[i];
  48. }
  49.  
  50. REP(i, n){
  51. REP(j, 10000){
  52. if (dp[i][j]){
  53. dp[i+1][j] = dp[i+1][j + points[i]] = true;
  54. }
  55. }
  56. }
  57.  
  58. cout << count_if(dp[n], dp[n] + 10000, [](bool x){return x; }) << endl;
  59.  
  60. return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement