結果

問題 No.942 プレゼント配り
ユーザー koi_kotyakoi_kotya
提出日時 2019-12-05 01:33:57
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 11,460 KB
実行使用メモリ 18,152 KB
最終ジャッジ日時 2023-08-21 12:25:04
合計ジャッジ時間 5,195 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 240 ms
18,152 KB
testcase_02 AC 77 ms
15,044 KB
testcase_03 AC 77 ms
15,288 KB
testcase_04 AC 179 ms
16,864 KB
testcase_05 WA -
testcase_06 AC 81 ms
15,072 KB
testcase_07 AC 78 ms
15,048 KB
testcase_08 AC 154 ms
16,656 KB
testcase_09 AC 166 ms
16,852 KB
testcase_10 AC 77 ms
15,256 KB
testcase_11 AC 76 ms
15,152 KB
testcase_12 AC 77 ms
15,160 KB
testcase_13 AC 76 ms
15,156 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 78 ms
15,252 KB
testcase_19 AC 77 ms
15,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,k = gets.split.map(&:to_i)
if (n/k).odd?
    puts "No"
else
    puts "Yes"
    a = Array.new(k).map{Array.new(n/k)}
    (0...(n/k)).each do |i|
        if (i.even?)
            (0...k).each do |j|
                a[j][i] = i*k+j+1
            end
        else
            (0...k).each do |j|
                a[j][i] = i*k+k-j
            end
        end
    end
    a.each do |arr|
        puts arr.join(" ")
    end
end
0