| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 141659 | 胡海峰老师 | 求元素在矩阵中的位置 | Python3 | Accepted | 32 MS | 3780 KB | 548 | 2025-12-27 19:46:10 |
# 读取输入 n, m = map(int, input().split()) # 读取矩阵 matrix = [] for _ in range(n): row = list(map(int, input().split())) matrix.append(row) # 标志是否找到元素 found = False # 遍历矩阵查找元素 for i in range(n): for j in range(n): if matrix[i][j] == m: # 找到目标元素 print("{} {}".format(i,j)) # 输出行和列(从0开始计数) found = True break if found: break # 如果没有找到 if not found: print(-1)