Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
112602 | 汤奕硕 | 字符串的奇偶性 | Python3 | Compile Error | 0 MS | 0 KB | 446 | 2025-03-09 18:40:20 |
import sys for line in sys.stdin: line = line.strip() if line == '#': break if not line: continue # 获取模式和比特部分 mode = line[-1] bits = line[:-1] count = bits.count('1') # 判断需要补0还是1 if mode == 'e': append = '0' if count % 2 == 0 else '1' else: # mode == 'o' append = '1' if count % 2 == 0 else '0' print(f"{bits}{append}")
File "Main.py", line 18 print(f"{bits}{append}") ^ SyntaxError: invalid syntax