a067: Binary Conversion 二進制轉換
標籤 : String 字串
通過比率 : 100% (13 人 / 13 人 ) (非即時)
評分方式 :
Tolerant

最近更新 : 2023-04-11 16:14

內容

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
測資資訊 :
記憶體限制 : 64 MB
隱藏 測資點#0 (25%): 1.0s , <1K
隱藏 測資點#1 (25%): 1.0s , <1K
隱藏 測資點#2 (25%): 1.0s , <1K
隱藏 測資點#3 (25%): 1.0s , <1K
提示 :
標籤:
String 字串
出處:
線上協同學習平臺 - ITSA 教育部資通訊軟體創新人才推升計畫 [編輯 :
zero_jason (zero_jason(MANAGER))
]


編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」