Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int g,h,t,re,s;
- scanf("%d",&t);
- int wq[t+3]={0};
- for(g=0;g<t;g++)scanf("%d",&wq[g]);
- for(g=re=0;g<(1<<t);g++){
- for(h=s=0;h<t;h++)
- if(g&(1<<h))s|=wq[h];
- re+=s;
- }
- printf("%d\n",re);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement