結果
問題 | No.401 数字の渦巻き |
ユーザー |
|
提出日時 | 2016-11-08 11:41:20 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 553 bytes |
コンパイル時間 | 481 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-11-25 04:44:22 |
合計ジャッジ時間 | 3,636 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
コンパイルメッセージ
Syntax OK
ソースコード
n=gets.to_iary = Array.new(n){|v| Array.new(n)}cnt = 1for i in 0..(n + 1)/2ulim = n - 1 - i# [i, ulim] * [i, ulim]for j in i .. ulimary[i][j] = cntcnt += 1endfor j in (i + 1) .. ulimary[j][ulim] = cntcnt += 1endfor j in (i .. (ulim - 1)).to_a.reverseary[ulim][j] = cntcnt += 1endfor j in ((i + 1) .. (ulim - 1)).to_a.reverseary[j][i] = cntcnt += 1endendfor i in 0 ... nfor j in 0 ... nprintf "%03d", ary[i][j]if j != n - 1print " "endendputsend