ACM模式下快速读取二维数组

ACM二维数组的读取

输入

5 5
0 1 0 0 0
0 1 1 1 0
0 0 0 0 0
0 1 1 1 0
0 0 0 1 0

读取

Scanner in = new Scanner(System.in);
int row = in.nextInt();
int col = in.nextInt();
int[][] arr = new int[row][col];
for (int i = 0; i < row; i++) {
   for (int j = 0; j < col; j++) {
         arr[i][j] = in.nextInt();
   }
}
posted @ 2023-09-09 11:04  爱新觉罗LQ  阅读(97)  评论(0编辑  收藏  举报