Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
127310 赵乘浩 矩阵右移动 Python3 Accepted 35 MS 3780 KB 425 2025-07-27 09:30:13

Tests(2/2):


Code:

m, n = map(int, input().split()) matrix = [] for _ in range(n): row = list(map(int, input().split())) matrix.append(row) shift = m % n # 计算有效移动位数,避免重复移动 result = [] for row in matrix: shifted_row = row[-shift:] + row[:-shift] result.append(shifted_row) for row in result: print(' '.join(map(str, row)) + ' ') # 确保每行末尾有空格,与示例一致