結果

問題 No.1587 012 Matrix
ユーザー simansiman
提出日時 2021-07-15 04:05:48
言語 Ruby
(3.3.0)
結果
AC  
実行時間 177 ms / 1,000 ms
コード長 242 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 11,364 KB
実行使用メモリ 19,652 KB
最終ジャッジ日時 2023-09-17 06:59:44
合計ジャッジ時間 4,494 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,264 KB
testcase_01 AC 81 ms
15,224 KB
testcase_02 AC 79 ms
15,180 KB
testcase_03 AC 82 ms
15,260 KB
testcase_04 AC 78 ms
15,148 KB
testcase_05 AC 80 ms
15,172 KB
testcase_06 AC 80 ms
15,288 KB
testcase_07 AC 80 ms
15,356 KB
testcase_08 AC 81 ms
15,392 KB
testcase_09 AC 83 ms
15,260 KB
testcase_10 AC 85 ms
15,168 KB
testcase_11 AC 88 ms
15,572 KB
testcase_12 AC 94 ms
15,912 KB
testcase_13 AC 104 ms
16,748 KB
testcase_14 AC 116 ms
16,936 KB
testcase_15 AC 132 ms
17,648 KB
testcase_16 AC 147 ms
18,336 KB
testcase_17 AC 159 ms
19,148 KB
testcase_18 AC 169 ms
19,432 KB
testcase_19 AC 173 ms
19,560 KB
testcase_20 AC 176 ms
19,584 KB
testcase_21 AC 177 ms
19,652 KB
testcase_22 AC 80 ms
15,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i

if N.odd?
  puts 'No'
  exit
end

ans = Array.new(N) { Array.new(N, 0) }

N.times do |y|
  if y < N / 2
    ans[y][N - y - 1] = 1
  end

  (N - y).upto(N - 1) do |x|
    ans[y][x] = 2
  end
end

puts ans.map { |row| row.join }
0