Type: Default 1000ms 256MiB

计算补码

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

输入一个“nn 位的二进制数” 的二进制原码 ss,请输出它对应的补码。

  • 正数:
    • 三种编码一样,最高位为 00,后面是这个数的二进制。
  • 负数:
    • 原码:最高位为 11,后面是这个数绝对值的二进制。
    • 反码:除了最高位外,每一位都是原码取反。
    • 补码:在反码基础上加 11

输入格式

输入 ss

输出格式

输出对应的补码。

011100001111
011100001111
1111000011111
1000111100001
1000
0000
1100
1100
1010
1110

数据规模与约定

对于 100%100\% 的数据,1n1001\le n \le 100

C++校统测三

Not Attended
Status
Done
Rule
Ledo
Problem
7
Start at
2024-12-22 9:45
End at
2024-12-30 17:45
Duration
200 hour(s)
Host
Partic.
8