DreamCHN @ 2024-02-22 12:13:00
全RE
def compress_pattern(compressed):
N = int(compressed[0])
matrix = [['0'] * N for _ in range(N)]
i = 1
j = 0
while i < len(compressed):
if j >= N:
j = 0
i += 1
for _ in range(int(compressed[i])):
matrix[j][i % N] = '1' if i % 2 == 0 else '0'
j += 1
return matrix
def print_matrix(matrix):
for row in matrix:
print(''.join(row))
def main():
compressed = input().split()
matrix = compress_pattern(compressed)
print_matrix(matrix)
if __name__ == "__main__":
main()
by a13968943778 @ 2024-02-22 12:25:36
@DreamCHN 哪道题?
by DreamCHN @ 2024-02-22 14:32:42
@a13968943778
看旁边所属板块