zxw0728 @ 2022-01-14 17:38:54
n=input()
a=0
n=n.replace('-','')
for i in range(9):
a+=(i+1)*int(n[i])
c=a%11
if n[9]=='X':
if c==10:
print('Right')
else:
print(n[0]+'-'+n[1:4]+'-'+n[4:9]+'-'+'%d'%(c))
else:
if c==10:
print(n[0]+'-'+n[1:4]+'-'+n[4:9]+'-'+'X')
else:
if c==n[9]:
print('Right')
else:
print(n[0]+'-'+n[1:4]+'-'+n[4:9]+'-'+'%d'%(c))
by zxw0728 @ 2022-01-14 17:39:48
第一个数据WA
by EC75 @ 2022-01-14 18:01:54
@zxw0728
ISBN = input()
strNum = ISBN[:12]
Sum = 0
j = 1
for i in strNum:
if i != '-':
n = int(i)
Sum = Sum + n * j
j += 1
else:
continue
if Sum % 11 == 10:
ID = 'X'
else:
ID = str(Sum % 11)
if ID == ISBN[12]:
print("Right")
else:
strNum = strNum + ID
print(strNum)
by zxw0728 @ 2022-01-15 11:12:30
@continue_and_break 好的谢谢