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;
- scanf("%d",&t);
- int wq[t+3];
- for(g=0;g<t;g++)scanf("%d",&wq[g]);
- for(g=re=0;g<(1<<t);g++)
- for(h=0;h<t;h++)
- if(g&(1<<h))re+=(wq[g]|wq[h]);
- printf("%d\n",re);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement