SRM CCC HACKER RANK:
Binary string duplication:
python
import sys
s = [0]
while len(s) < 1000:
s += [1-x for x in s]
def duplication(s, x):
return s[x]
q = int(input().strip())
for a0 in range(q):
x = int(input().strip())
result = duplication(s,x)
print(result)
Comments
Post a Comment