80,求大佬

P1307 [NOIP2011 普及组] 数字反转

python无极限 @ 2021-08-13 20:36:34

l = int(input())
if l>0:
    l=str(l)
    l=list(l)
    l.reverse()
    a=len(l)
    if l[0]=="0":
        b=1
    else:
        b=0
    for  i in range(b,a):
        print(l[i],end="")
elif l<0:
    l=str(l)
    l=list(l)
    a=len(l)
    l=l[1:a]
    l.reverse()
    print("-",end="")
    if l[0]=="0":
        b=1
    else:
        b=0
    for i in range(b,a-1):
        print(l[i],end="")
elif l==0:
    print("0")

by SmokedFish @ 2021-08-13 20:41:56

@python无极限 没具体调试,但目测给你一个 1000000 之类的会挂,因为只判了一个 0


by python无极限 @ 2021-08-13 20:46:21

@郑代梅zdm 0好像也错了


|