题解 | #进制转换#
进制转换
https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
n_16 = input()[2:] n_10 = 0 for i in range(len(n_16)-1, -1, -1): if "A" <= n_16[i] <= "F": temp = 10 + ord(n_16[i]) - ord("A") else: temp = int(n_16[i]) n_10 += temp * 16**(len(n_16) - i - 1) print(n_10)