啊哈添柴挑戰Java1672. 棋盤(簡化版)

啊哈添柴——挑戰

1672. 棋盤(簡化版)

在這裏插入圖片描述
在這裏插入圖片描述

import java.util.Scanner;

/**
 * @author yinglongwu
 */
//1672. 棋盤(簡化版)
public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int m = scanner.nextInt();
		int n = scanner.nextInt();
		int[][] arr = new int[m][m];
		for (int i = 0; i < n; i++) {
			int x = scanner.nextInt();
			int y = scanner.nextInt();
			arr[x-1][y-1] = scanner.nextInt();
		}
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < m; j++) {
				System.out.print(arr[i][j]+" ");
			}
			System.out.println();
		}
	}

}

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章