记录详情

Compile Error

/in/foo.cc:2:7: error: invalid preprocessing directive #�
     # 检查符号位,如果为1,说明是负数,直接返回原反码
       ^
/in/foo.cc:6:7: error: invalid preprocessing directive #�
     # 如果是正数,我们需要计算其补码
       ^
/in/foo.cc:7:7: error: "1." after # is not a positive integer
     # 1. 取反
       ^~
/in/foo.cc:10:7: error: "2." after # is not a positive integer
     # 2. 加2,实际上是在取反的基础上加1,因为-2进制的加2相当于二进制的加1
       ^~
/in/foo.cc:11:7: error: invalid preprocessing directive #�
     # 从最低位开始加,直到进位结束
       ^
/in/foo.cc:21:7: error: invalid preprocessing directive #�
     # 如果最高位是1,说明没有进位,可以去掉这个1
       ^
/in/foo.cc:25:7: error: invalid preprocessing directive #�
     # 将结果转换为字符串
       ^
/in/foo.cc:26:12: error: empty character constant
     return ''.join(inverted)
            ^~
/in/foo.cc:28:3: error: invalid preprocessing directive #�
 # 测试用例
   ^
/in/foo.cc:30:5: warning: multi-character character constant [-Wmultichar]
     '00',  # 0
     ^~~~
/in/foo.cc:30:12: error: stray '#' in program
     '00',  # 0
            ^
/in/foo.cc:31:5: warning: multi-character character constant [-Wmultichar]
     '01',  # 1
     ^~~~
/in/foo.cc:31:12: error: stray '#' in program
     '01',  # 1
            ^
/in/foo.cc:32:5: warning: multi-character character constant [-Wmultichar]
     '11',  # 3
     ^~~~
/in/foo.cc:32:12: error: stray '#' in program
     '11',  # 3
            ^
/in/foo.cc:33:5: warning: multi-character character constant [-Wmultichar]
     '10',  # 2
     ^~~~
/in/foo.cc:33:12: error: stray '#' in program
     '10',  # 2
            ^
/in/foo.cc:34:5: warning: multi-character character constant [-Wmultichar]
     '1101' # -3
     ^~~~~~
/in/foo.cc:34:12: error: stray '#' in program
     '1101' # -3
            ^
/in/foo.cc:1:1: error: 'def' does not name a type
 def to_negative_two_complement(binary_string):
 ^~~

信息

递交者
类型
自测
题目
P1570 Problem 2B. p进制数2
语言
C++
递交时间
2024-04-22 16:05:30
评测时间
2024-04-22 16:05:30
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes