結果

問題 No.1169 Row and Column and Diagonal
ユーザー neko_the_shadowneko_the_shadow
提出日時 2020-08-24 10:17:49
言語 Ruby
(3.3.0)
結果
AC  
実行時間 271 ms / 2,000 ms
コード長 181 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 14,336 KB
最終ジャッジ日時 2024-04-24 01:22:24
合計ジャッジ時間 3,862 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
12,160 KB
testcase_01 AC 91 ms
12,288 KB
testcase_02 AC 90 ms
12,288 KB
testcase_03 AC 88 ms
12,160 KB
testcase_04 AC 90 ms
12,288 KB
testcase_05 AC 92 ms
12,032 KB
testcase_06 AC 110 ms
12,544 KB
testcase_07 AC 128 ms
12,544 KB
testcase_08 AC 148 ms
12,800 KB
testcase_09 AC 174 ms
12,928 KB
testcase_10 AC 248 ms
13,824 KB
testcase_11 AC 263 ms
14,080 KB
testcase_12 AC 267 ms
14,080 KB
testcase_13 AC 271 ms
14,336 KB
testcase_14 AC 270 ms
14,208 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a = Array.new(n){Array.new(n)}

[*0...n].product([*0...n]) do |i, j|
  a[i][j] = (2*i-j+n)%n
end

a.each do |row|
  line = row.map{|v| v + 1}.join(" ")
  puts line
end
0