题解 | #牛牛的10类人#

牛牛的10类人

https://www.nowcoder.com/practice/232b7fc32fac4636819e31a7d7c960a3

def f(n):
    n = bin(n)[2:]
    zero = n.count('0')
    one = n.count('1')

    if (zero % 2 == 0) and (one % 2 != 0):
        return '0'
    elif (one % 2 == 0) and (zero % 2 != 0):
        return '1'
    elif (zero % 2 == 0) and (one % 2 == 0):
        return '10'
    
    return '100'


dummy = input()
nums = map(int,input().split())

lst = []
for i in nums:
    lst.append(f(i))

print(' '.join(lst))

全部评论

相关推荐

听说改名字就能收到offer哈:Radis写错了兄弟
点赞 评论 收藏
分享
1 收藏 评论
分享
牛客网
牛客企业服务