fork download
  1. class Solution:
  2. # @param A : list of integers
  3. # @return an integer
  4. def cntBits(self, A):
  5. res=0
  6. n=len(A)
  7. for i in range(31):
  8. ans=0
  9. for j in range(n):
  10. if ((A[j])&(1<<i)):
  11. ans=(ans+1)%100000007
  12. res=(res+(ans*((n-ans)%10000007)))%100000007
  13. return 2*res
Success #stdin #stdout 0.04s 9536KB
stdin
Standard input is empty
stdout
Standard output is empty