#18949: Python


jay1060920909@gmail.com (Jay Chen)

學校 : 桃園市立大成國民中學
編號 : 84276
來源 : [118.168.12.205]
最後登入時間 :
2022-12-17 21:40:06
a054. 電話客服中心 -- 板橋高中教學題 | From: [193.116.234.252] | 發表日期 : 2019-08-16 13:53

dic = {10:"A",11:'B',12:'C',13:'D',14:'E',15:'F',16:'G',17:'H',34:'I',
18:'J',19:'K',20:'L',21:'M',22:'N',35:'O',23:'P',24:'Q',25:'R'
,26:'S',27:'T',28:'U',29:'V',32:'W',30:"X",31:'Y',33:'Z'}

li = list(dic.values()) #所有的英文字母

code = list('100725702')

value = [] #值

res = {} #驗證

for n in dic.keys():
value.append(list(str(n))) #將所有字母加到value裡

for i in range(len(value)):
value[i].extend(code) #將字母加到數字裡
value[i] = [int(value[i]) for value[i] in value[i]]

#test
test = [1, 5, 1, 3, 0, 2, 4, 5, 6, 7, 5]

for i in range(9,0,-1):
index = 10-i
test[index] = test[index]*i

r = sum(test)

#test

for i in range(9,0,-1):
for j in range(len(value)):
index = 10-i
value[j][index] = value[j][index]*i

for i in range(len(value)):
value[i] = sum(value[i])
res[value[i]] = li[i]
if value[i] % 10 == 0:
print(res[value[i]],end='')
 
ZeroJudge Forum