23dfcca431 2011-02-23 kinaba: int bitcnt(LL x) 23dfcca431 2011-02-23 kinaba: { 23dfcca431 2011-02-23 kinaba: int c = 0; 23dfcca431 2011-02-23 kinaba: for(; x; x>>=1) 23dfcca431 2011-02-23 kinaba: c += x&1; 23dfcca431 2011-02-23 kinaba: return c; 23dfcca431 2011-02-23 kinaba: } 8f8efc5938 2013-06-27 kinaba: 8f8efc5938 2013-06-27 kinaba: 8f8efc5938 2013-06-27 kinaba: /* for every nonempty subset of S : O(2^|S|) 8f8efc5938 2013-06-27 kinaba: for(int sub=S; sub; sub=(sub-1)&S) { ... } 8f8efc5938 2013-06-27 kinaba: 8f8efc5938 2013-06-27 kinaba: */