小米第一题异数83%,第二题蓄水池不会 好气
# -*- coding: utf-8 -*- """ Created on Thu Sep 20 19:33:18 2018 @author: zhex """ nums = [] line = [] while True: _input = input() if _input != 'END': #继续输入值 num = _input.split('#') nums.append(num) jinzhi = int(num[0]) shuzhi = num[1][::-1] res = 0 if jinzhi <= 10: for i in range(len(shuzhi)): res += int(shuzhi[i])*(jinzhi**i) line.append(res) else: #10进制以上 for i in range(len(shuzhi)): if shuzhi[i] == 'a': res += 10*(jinzhi**i) elif shuzhi[i] == 'b': res += 11*(jinzhi**i) elif shuzhi[i] == 'c': res += 12*(jinzhi**i) elif shuzhi[i] == 'd': res += 13*(jinzhi**i) elif shuzhi[i] == 'e': res += 14*(jinzhi**i) elif shuzhi[i] == 'f': res += 15*(jinzhi**i) else: res += int(shuzhi[i])*(jinzhi**i) line.append(res) else: #算结果 counts = [] for i in range(len(line)): count = 0 for val2 in line: if val2 == line[i]: count += 1 counts.append(count) if count == 1: print('#'.join(nums[i])) if 1 in count: pass else: #没有异数 print(' None') break
#小米#