結果

問題 No.1764 Square
ユーザー Merry-AmorMerry-Amor
提出日時 2021-12-02 18:16:12
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 924 bytes
コンパイル時間 37 ms
コンパイル使用メモリ 11,372 KB
実行使用メモリ 15,232 KB
最終ジャッジ日時 2023-09-18 10:24:14
合計ジャッジ時間 1,728 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,156 KB
testcase_01 AC 80 ms
14,964 KB
testcase_02 AC 77 ms
15,172 KB
testcase_03 AC 78 ms
15,036 KB
testcase_04 AC 77 ms
14,980 KB
testcase_05 AC 79 ms
15,232 KB
testcase_06 AC 83 ms
15,076 KB
testcase_07 AC 79 ms
15,208 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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