【PY3】看起来这我的输出和题给的完全一致,但还是爆零,为什么会这样呢?

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

Miting @ 2021-01-26 14:14:02

col = int(input())
#初始化
mat_before = []

def add_dot(mat):
    mat.append('.....')
def add_0(mat):
    mat.append('XXXXX')
    mat.append('X...X')
    mat.append('XXXXX')
def add_1(mat):
    mat.append('.....')
    mat.append('.....')
    mat.append('XXXXX')
def add_2(mat):
    mat.append('X.XXX')
    mat.append('X.X.X')
    mat.append('XXX.X')
def add_3(mat):
    mat.append('X.X.X')
    mat.append('X.X.X')
    mat.append('XXXXX')
def add_4(mat):
    mat.append('XXX..')
    mat.append('..X..')
    mat.append('XXXXX')
def add_5(mat):
    mat.append('XXX.X')
    mat.append('X.X.X')
    mat.append('X.XXX')
def add_6(mat):
    mat.append('XXXXX')
    mat.append('X.X.X')
    mat.append('X.XXX')
def add_7(mat):
    mat.append('X....')
    mat.append('X....')
    mat.append('XXXXX')
def add_8(mat):
    mat.append('XXXXX')
    mat.append('X.X.X')
    mat.append('XXXXX')
def add_9(mat):
    mat.append('XXX.X')
    mat.append('X.X.X')
    mat.append('XXXXX')

number = input()
for i in number:
    if i == '0': add_0(mat_before)
    elif i == '1': add_1(mat_before)
    elif i == '2': add_2(mat_before)
    elif i == '3': add_3(mat_before)
    elif i == '4': add_4(mat_before)
    elif i == '5': add_5(mat_before)
    elif i == '6': add_6(mat_before)
    elif i == '7': add_7(mat_before)
    elif i == '8': add_8(mat_before)
    else: add_9(mat_before)
    add_dot(mat_before)
mat_before.pop()
transpose = [[mat_before[j][i] for j in range(len(mat_before))] for i in range(len(mat_before[0]))]
for i in transpose: 
    for j in i[:-1]: 
        print(j,end='')
    print(i[-1])
我的:
..X...X.X.X.XXX...X.X.X
..X...X.X.X.X.....X.X.X
..X...X.XXX.XXX...X.XXX
..X...X...X...X...X...X
..X...X...X.XXX...X...X
1_out:
..X...X.X.X.XXX...X.X.X
..X...X.X.X.X.....X.X.X
..X...X.XXX.XXX...X.XXX
..X...X...X...X...X...X
..X...X...X.XXX...X...X

怎么臭的点有存在的必要吗?()


by Reywmp @ 2021-01-26 15:07:08

这个点我笑死


by PragmaGCC @ 2021-01-26 15:08:56

好臭啊*恼*


by Miting @ 2021-01-27 00:25:54

所以哪里出问题了啊呜呜呜. > <


|