Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Online Python compiler (interpreter) to run Python online.
- # Write Python 3 code in this online editor and run it.
- #a=[1,3,5,2]
- import sys
- import heapq as hq
- from functools import reduce
- input =sys.stdin.readline
- t=int(input())
- for i in range(t):
- a=input().split()
- for i in range(len(a)):
- a[i]=int(a[i])
- tsum=1<<32-1
- for i in a:
- tsum=tsum & i
- print("tsum",tsum)
- if tsum>0:
- print(1)
- else:
- ans=0
- n=len(a)
- mask=(1<<32)-1
- for j in range(n):
- mask=mask&a[j]
- if mask==0:
- ans+=1
- mask=(1<<32)-1
- print(ans)
Advertisement
Add Comment
Please, Sign In to add comment