結果

問題 No.361 門松ゲーム2
ユーザー fine
提出日時 2016-04-17 23:54:25
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 507 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-10-04 11:07:14
合計ジャッジ時間 3,112 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15 WA * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

l, d = gets.split.map(&:to_i)
if d > 2
    puts ['matsu', 'kado'][((l - 1) / 5) % 2]
else
    if d == 1
        puts 'matsu'
    else
        if l % 3 == 0
            c = 0
            while l > 3
                x = (l - 3) / 3
                if x % 3 == 0
                    l = x
                else
                    l = x + 3 - x % 3
                end
                c += 1
            end
            puts ['matsu', 'kado'][c % 2]
        else
            puts 'matsu'
        end
    end
end
0