python求助,30分

P1055 [NOIP2008 普及组] ISBN 号码

李翊辰2012 @ 2023-09-30 15:25:10

b=a.pop()
i=1
c=0
for cnt in a:
    for q in cnt:
        c+=int(q)*i
        i+=1
if c%11==int(b):
    print("Right")
else:
    for p in a:
        print(p,end="-")
    print(c%11)

3AC+4RE+3WA


by 李翊辰2012 @ 2023-09-30 15:27:59

b=a.pop()
i=1
c=0
for cnt in a:
    for q in cnt:
        c+=int(q)*i
        i+=1
c%=11
if c==int(b):
    print("Right")
else:
    for p in a:
        print(p,end="-")
    if c==10:
        print("X")
    else:
        print(c)

改了之后WA没了(勿喷)


|