_Patrick_Star_ @ 2024-11-21 21:31:41
求助,哪里错
a=list(input())
lst=[]
sb=0
for k in a:
if k != "-":
lst.append(int(k))
for i in range(len(lst)-1):
sb+=lst[i]*(i+1)
lst.reverse()
if sb%11== lst[0]:
print("Right")
else:
d=sb%11
a.pop(len(a)-1)
for i in a:
print(i,end="")
if d == 10:
print("X")
else:
print(d)
by yuechenxi130407 @ 2024-11-21 21:42:11
a=str(input())
cs=1
ans=0
f=0
for i in range(11):
if (a[i]=='-'):
continue
ans+=int(a[i])*cs
cs+=1
if ans%11==10:
if a[12]=='X':
print("Right")
f=1
if a[12]>='0' and a[12]<='9':
if ans%11==int(a[12]):
print("Right")
f=1
if f!=1:
for i in range(12):
print(a[i],end='')
if ans%11<=9:
print(ans%11)
else:
print('X')
这玩意很恶心的,就是得多加特判。
我调这玩意调了2h,就是瞎调
by _Patrick_Star_ @ 2024-11-21 21:49:37
@yuechenxi130407谢啦?