#41279: python


suyueh (suyueh)

學校 : 不指定學校
編號 : 272111
來源 : [49.216.220.150]
最後登入時間 :
2024-12-26 21:34:55
a020. 身分證檢驗 | From: [125.229.229.84] | 發表日期 : 2024-07-16 14:00

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

number = dict[id[0]] # 對照字典 將身分證的英文字母轉換為數字
num1 = number // 10 # 數字的十位數
num2 = number % 10 # 數字的個位數

total_num = num1 + num2 * 9 + int(id[9]) # 先把題目要求的第2步以及最後一碼相加

for i in range(1, 9): #加上第三步
    total_num = total_num + int(id[i]) * (9-i)

real = (total_num % 10 == 0) #定義boolean值 real 判斷total_num是否整除10

if (real): # 輸出
    print("real")
else:
    print("fake")
 
ZeroJudge Forum