#28254: 初學者寫法，拜託指教

#### shunrenshih@gmail.com (shawn)

School : 高雄市立高雄高級中學
ID : 175593
2022-01-26 23:03:40
a020. 身分證檢驗 | From: [140.116.247.232] | Post Date : 2021-11-21 15:41

dic = { "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  }

su=0

b=str(input()) #輸入身分證 E123456789

c=b[::-1] #倒轉的身分證字號 987654321E

d=c[:-1] #把最後一個英文和刪掉 987654321

e=b[0] #身分證第一碼 E

f=b[-1] #最後一馬

g=dic[e]

for i in range (9):

su += int(d[i])*i

h=(int(f)+su+(g%10)*9+g//10)

if (h%10 == 0):

print("real")

else:

print("fake")

#28497: Re:初學者寫法，拜託指教

#### yp11051002@yphs.tp.edu.tw (19王亮諭 705)

School : No School
ID : 163553
2021-12-14 09:05:39
a020. 身分證檢驗 | From: [203.72.178.1] | Post Date : 2021-12-14 09:38

dic = { "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  }

su=0

b=str(input()) #輸入身分證 E123456789

c=b[::-1] #倒轉的身分證字號 987654321E

d=c[:-1] #把最後一個英文和刪掉 987654321

e=b[0] #身分證第一碼 E

f=b[-1] #最後一馬

g=dic[e]

for i in range (9):

su += int(d[i])*i

h=(int(f)+su+(g%10)*9+g//10)

if (h%10 == 0):

print("real")

else:

print("fake")

ZeroJudge Forum