题解 | #牛牛的10类人#

牛牛的10类人

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

import sys

n = [i.strip().split() for i in sys.stdin.readlines()]
cnt = int(n[0][0])
num = list(map(int, n[1]))
for i in num:
    s = f'{i:b}'
    zero_cnt = s.count('0')
    one_cnt = s.count('1')
    if zero_cnt%2==0 and one_cnt%2==0:
        print('10 ', end='')
    elif zero_cnt%2==0:
        print('0 ', end='')
    elif one_cnt%2==0:
        print('1 ', end='')
    else:
        print('100 ', end='')
 
全部评论
你这个代码死循环了hhhhhhh
点赞 回复 分享
发布于 2022-08-03 22:33

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务