Logo
(追記) (追記ここまで)

26512번 - Complimentary 다국어

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

문제

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

힌트

출처

School > PLU High School Programming Contest > PLU 2016 > Advanced 4번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /