結果

問題 No.1764 Square
ユーザー Merry-Amor
提出日時 2021-12-02 18:16:12
言語 Ruby
(3.4.1)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 924 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-05 02:00:01
合計ジャッジ時間 1,533 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

zero = ["A", "E"]
one = ["B"]
two = ["C"]
three = ["D"]

inputK = gets
K = inputK.to_i

ii = 0
iii = 0
memory = ""

for i in 0..(K-1) do
        ii = i%4
        case ii
        when 0 then
                memory = zero[0]
                zero.delete_at(0)
        when 1 then
                memory = one[0]
                one.delete_at(0)
        when 2 then
                memory = two[0]
                two.delete_at(0)
        when 3 then
                memory = three[0]
                three.delete_at(0)
        end

        iii = (i+1)%4
        case iii
        when 0 then
                zero.push(memory)
        when 1 then
                one.push(memory)
        when 2 then
                two.push(memory)
        when 3 then
                three.push(memory)
        end

end

zero = zero.join('')
one = one.join('')
two = two.join('')
three = three.join('')


puts zero
puts one
puts two
puts three
0