Python,样例可以运行,下载的数据运行也没有问题,但是一测试就全RE

P5730 【深基5.例10】显示屏

wsygjr @ 2022-03-06 11:50:59

N=int(input())
b=input()
c=[]
def hxy(number):
    if number=='0':
        return ['XXX','X.X','X.X','X.X','XXX']
    if number=='1':
        return ['..X','..X','..X','..X','..X']
    if number=='2':
        return ['XXX','..X','XXX','X..','XXX']
    if number=='3':
        return ['XXX','..X','XXX','..X','XXX']
    if number=='4':
        return ['X.X','X.X','XXX','..X','..X']
    if number=='5':
        return ['XXX','X..','XXX','..X','XXX']
    if number=='6':
        return ['XXX','X..','XXX','X.X','XXX']
    if number=='7':
        return ['XXX','..X','..X','..X','..X']
    if number=='8':
        return ['XXX','X.X','XXX','X.X','XXX']
    if number=='9':
        return ['XXX','X.X','XXX','..X','XXX']
for x in b:
    a=hxy(x)
    for y in range(0,5):
        c.append(a[y])
for x in range(0,5):
    for y in range(0,N):
        if y==N-1:
            print(c[5*y+x],end='')
        else:
            print(c[5*y+x],end='.')
    print()

那位大佬来救一救


by Terrible @ 2022-03-06 13:28:22

@wsygjr

b=input().strip()

第二行数据末尾可能读到 \r


by wsygjr @ 2022-03-06 13:56:18

AC了,谢谢大佬


|