Python3 90分求助qwq
查看原帖
Python3 90分求助qwq
779166
SingularityVVVIP楼主2022/9/10 21:34
l=input().split('-')
s=l[0]+l[1]+l[2]
n=0
d=0

for i in s:
      n=n+1
      d=d+int(i)*n

d=d%11

if d==10:
      if l[3]=='X':
            print('Right')
      else:
            print('{}-{}-{}-{}'.format(l[0],l[1],l[2],'X'))
else:
      if l[3]==str(d):
            print('Right')
      else:
            print('{}-{}-{}-{}'.format(l[0],l[1],l[2],d))

当输入为6-670-82162-X,输出'Right'。唯一一组WA。

2022/9/10 21:34
加载中...