while 1: # 每组第一行是N和M nm = list(map(int, input().split(" "))) N = nm[0] M = nm[1] # Q = [[0 for _ in range(M)] for _ in range(N)] for i in range(N): abc = list(map(int, input().split(" "))) for j in range(M): Q[i][j] = abc[j] # print(Q) Max_Q = max(N, M) for i in range(Max_Q): if N > M: if i > M - 1: break for j in range(Max_Q): if j == N - 1: print(str(Q[j][i])) break elif j < N - 1: print(str(Q[j][i]), end=' ')
全部评论
(0) 回帖