7-1 sdut-查验身份证
这里的“X”是大写
mp = {}
for i in range(3, 11):
mp[i] = chr(48 + 12 - i)
mp[0] = "1"
mp[1] = "0"
mp[2] = "X"
judge = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
ans = 0
pao = []
n = int(input())
for i in range(n):
x = input()
num = 0
flag = 1
for j in range(17):
if (x[j].isdigit()):
num += int(x[j]) * judge[j]
else:
flag = 0
num %= 11
# print(x[-1],mp[num],num)
if (x[-1] != mp[num]):
flag = 0
if (flag): ans += 1
else: pao.append(x)
if (ans == n):
print("All passed")
else:
for i in pao:
print(i)