시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB121958477.778%

문제

Two’s complement is used to express negative numbers in binary. For example, the value 30 in signed 8- bit binary is 00011110, and the signed 8-bit two’s complement representation of -30 is 11100010. An easy way to convert from 00011110 to 11100010 is simply reverse 00011110 to become 11100001, and then add 1, which produces 11100010.

Your job is to read in two positive integers, express them in 8-bit signed binary, then their negative values in two’s complement, and then the difference between the two in 8-bit signed binary.

For example, the difference between 30 and 18 is 12, which in 8-bit signed binary is 00001100, or if you subtract 18 – 30, you get -12, which in two’s complement (signed 8-bit) is the reverse of 00001100 + 1, or 11110011 + 1, or 11110100.

입력

Several pairs of positive integers X and Y, each pair on one line, with 0

출력

For each pair of values, five 8-bit signed strings, representing X, Y, -X, -Y, and X-Y, with a blank line following each output set.

예제 입력 1

30 18
18 30
100 50
0 0

예제 출력 1

30 = 00011110
18 = 00010010
-30 = 11100010
-18 = 11101110
12 = 00001100

18 = 00010010
30 = 00011110
-18 = 11101110
-30 = 11100010
-12 = 11110100

100 = 01100100
50 = 00110010
-100 = 10011100
-50 = 11001110
50 = 00110010