Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
85857 梁敖铭 螺旋矩阵 Java Wrong Answer 0 MS 320 KB 687 2024-07-20 21:15:33

Tests(0/10):


Code:

import java.util.Arrays; import java.util.Scanner; public class SpiralMatrix { private void printArray(int[][] arr) { int length = arr.length - 1; if (arr.length != 1) { for (int i = 1; i <= length; ++i) { for (int n, j = 1; j <= length; ++j) { System.out.print(String.format("% -8d", arr[i][j])); } System.out.println(); } } else { System.out.print("input length error!"); } } private int[][] getArray(int n) { int[][] arr = new int[n + 1][n + 1]; for (int[] a : arr) { Arrays.fill(


Run Info:

------Input------
5
------Answer-----
1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
------Your output-----