Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
63835 张江鹏 矩阵对角线 C++ Compile Error 0 MS 0 KB 705 2024-01-19 21:24:04

Tests(0/0):


Code:

/** * 沿对角线打印 * 同一层级的横坐标和纵坐标之和相等 * * @param */ private static void slash(int[][] matrix) { int cols = matrix[0].length; int rows = matrix.length; //层级 for (int l = 0; l < cols + rows - 1; l++) { int sum = l; for (int i = 0; i < rows; i++) { int j = sum - i; if (i >= 0 && i < rows && j >= 0 && j < cols) { System.out.print(matrix[i][j] + " "); //System.out.print("i: " + i + " j: " + j + " "); } } System.out.println(); } }


Run Info:

Main.cc:7:5: error: expected unqualified-id before 'private'
     private static void slash(int[][] matrix) {
     ^