Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
124343 柯轶炜 字符串的奇偶性 Python3 Accepted 36 MS 3748 KB 317 2025-07-11 11:50:17

Tests(1/1):


Code:

while True: line = input().strip() if line == '#': break bits = line[:-1] parity = line[-1] count = bits.count('1') if parity == 'e': last_bit = '0' if count % 2 == 0 else '1' else: last_bit = '1' if count % 2 == 0 else '0' print(bits + last_bit)