Convert two binary numbers into two decimal numbers and compute their sum. Your program has to convert two binary numbers b1, b2 of 8 bits into two decimal numbers d1, d2 respectively. Then compute the result of (d1+d2).
將兩個二進制數轉換為兩個十進制數並計算它們的總和。您的程式必須將兩個二進制數b1,b2的8個位元轉換為兩個十進制數d1,d2。然後計算(d1 + d2)的結果。
The input consists of N cases. The first line of the input contains only one positive integer N indicating the number of test cases, followed by N following cases. Each case is exactly in one line with two binary numbers b1, b2 (at most 8 digits, and each digit is either 0 or 1) separated by one space. Note that 1 ≤ N ≤ 5.
輸入由N個案例組成。輸入的第一行只包含一個表示測試案例數量的正整數N,後面跟著N個情況。每個案例恰好在一行中,包含兩個二進制數b1,b2(最多8位,每個數字為0或1)由一個空格分隔。注意 1 ≤ N ≤ 5。
For each case, print the result in one line.
對於每種情況,將結果輸出在一行中。
2 01010000 00000001 11110000 10000000
81 368
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
沒有發現任何「解題報告」 |