Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <list>
- #include <map>
- #include <set>
- #include <queue>
- #include <deque>
- #include <stack>
- #include <bitset>
- #include <algorithm>
- #include <functional>
- #include <numeric>
- #include <utility>
- #include <sstream>
- #include <iostream>
- #include <iomanip>
- #include <cstdio>
- #include <cmath>
- #include <cstdlib>
- #include <ctime>
- #include <ctime>
- #include <cstring>
- #define MAX 100000*20+1
- using namespace std;
- bool flag[MAX];
- class NumbersChallenge
- {
- public:
- int MinNumber(vector <int> S)
- {
- int n=S.size();
- memset(flag,false,sizeof flag);
- for(int i=0; i<(1<<n); i++)
- {
- int sum=0;
- for(int j=0; j<n; j++)
- if(i&(1<<j)) sum+=S[j];
- flag[sum]=true;
- }
- int r=1;
- while(flag[r]) r++;
- return r;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement