結果

問題 No.1587 012 Matrix
ユーザー ks2mks2m
提出日時 2021-07-08 22:36:35
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 827 bytes
コンパイル時間 2,041 ms
使用メモリ 39,100 KB
最終ジャッジ日時 2023-02-01 18:46:01
合計ジャッジ時間 5,844 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 92 ms
37,512 KB
testcase_01 AC 90 ms
37,344 KB
testcase_02 AC 92 ms
37,436 KB
testcase_03 AC 88 ms
37,644 KB
testcase_04 AC 91 ms
37,360 KB
testcase_05 AC 90 ms
37,384 KB
testcase_06 AC 93 ms
37,508 KB
testcase_07 AC 92 ms
37,412 KB
testcase_08 AC 93 ms
37,404 KB
testcase_09 AC 94 ms
37,448 KB
testcase_10 AC 93 ms
37,540 KB
testcase_11 AC 94 ms
37,484 KB
testcase_12 AC 96 ms
37,520 KB
testcase_13 AC 101 ms
37,960 KB
testcase_14 AC 101 ms
38,076 KB
testcase_15 AC 116 ms
38,700 KB
testcase_16 AC 109 ms
38,200 KB
testcase_17 AC 113 ms
38,288 KB
testcase_18 AC 119 ms
38,896 KB
testcase_19 AC 127 ms
39,012 KB
testcase_20 AC 126 ms
39,100 KB
testcase_21 AC 125 ms
39,012 KB
testcase_22 AC 89 ms
37,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		char[][] s = new char[n][n];
		for (int i = 0; i < n; i++) {
			Arrays.fill(s[i], '0');
		}
		for (int i = 0; i < n; i++) {
			for (int j = i; j < n; j++) {
				s[i][j] = '2';
			}
			if (i < n / 2) {
				s[i][i] = '1';
			}
		}
		for (int i = 0; i < n; i++) {
			System.out.println(s[i]);
		}

//		for (int i = 0; i < n; i++) {
//			int sum = 0;
//			for (int j = 0; j < n; j++) {
//				sum += s[i][j] - '0';
//			}
//			System.out.println(sum);
//		}
//		for (int j = 0; j < n; j++) {
//			int sum = 0;
//			for (int i = 0; i < n; i++) {
//				sum += s[i][j] - '0';
//			}
//			System.out.println(sum);
//		}
	}
}
0