题解 | #进制转换#
进制转换
http://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
while True: try: s = input().strip() except EOFError: break #开始处理每一组输入 def getweight(ch): if ord(ch) >= ord('A') and ord(ch) <= ord('F'): return 10 + ord(ch) - ord('A') else: return int(ch) s = s.upper() num = 0 for i in range(2,len(s)): ch = s[i] num += getweight(ch) if i+1 < len(s): num = num * 16 print(num)