题解 | #蛇形矩阵#
蛇形矩阵
https://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
n = int(input()) dp = [[]for i in range(n)] num = 1 for i in range(n): for j in range(i+1): # dp[i].append(num) num += 1 for i in range(n): for j in dp: if j: print(j.pop(),end=' ') print()