結果

問題 No.1587 012 Matrix
ユーザー yuruhiyayuruhiya
提出日時 2021-07-09 13:36:21
言語 Crystal
(1.11.2)
結果
AC  
実行時間 7 ms / 1,000 ms
コード長 300 bytes
コンパイル時間 19,854 ms
コンパイル使用メモリ 255,404 KB
実行使用メモリ 6,292 KB
最終ジャッジ日時 2023-09-14 06:27:45
合計ジャッジ時間 19,499 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,488 KB
testcase_01 AC 3 ms
4,396 KB
testcase_02 AC 2 ms
4,468 KB
testcase_03 AC 3 ms
4,408 KB
testcase_04 AC 2 ms
4,468 KB
testcase_05 AC 3 ms
4,412 KB
testcase_06 AC 3 ms
4,412 KB
testcase_07 AC 3 ms
4,452 KB
testcase_08 AC 2 ms
4,516 KB
testcase_09 AC 3 ms
4,528 KB
testcase_10 AC 3 ms
4,592 KB
testcase_11 AC 3 ms
4,608 KB
testcase_12 AC 4 ms
4,904 KB
testcase_13 AC 4 ms
4,940 KB
testcase_14 AC 4 ms
5,272 KB
testcase_15 AC 5 ms
5,816 KB
testcase_16 AC 5 ms
5,956 KB
testcase_17 AC 6 ms
6,216 KB
testcase_18 AC 7 ms
6,164 KB
testcase_19 AC 7 ms
6,292 KB
testcase_20 AC 7 ms
6,284 KB
testcase_21 AC 7 ms
6,120 KB
testcase_22 AC 2 ms
4,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = read_line.to_i
m = n // 2
a = Array.new(n) { [1] * n }
(0...m).each { |i| (0..i).each { |j| a[i][j] = 0 } }
(0...m).each { |i| (m...n).each { |j| a[i][j] = 0 } }
(m...n).each { |i| (0...m).each { |j| a[i][j] = 2 } }
(m...n).each { |i| (m...i).each { |j| a[i][j] = 2 } }
puts a.join('\n', &.join)
0