結果

問題 No.740 幻の木
ユーザー maimai
提出日時 2018-10-05 21:29:40
言語 Ruby
(3.3.0)
結果
AC  
実行時間 208 ms / 2,000 ms
コード長 202 bytes
コンパイル時間 63 ms
コンパイル使用メモリ 11,352 KB
実行使用メモリ 15,260 KB
最終ジャッジ日時 2023-08-02 16:53:42
合計ジャッジ時間 1,601 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,144 KB
testcase_01 AC 82 ms
15,260 KB
testcase_02 AC 81 ms
15,204 KB
testcase_03 AC 80 ms
15,032 KB
testcase_04 AC 82 ms
15,260 KB
testcase_05 AC 81 ms
15,140 KB
testcase_06 AC 208 ms
15,100 KB
testcase_07 AC 81 ms
15,164 KB
testcase_08 AC 81 ms
15,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def ascan; gets.split.map(&:to_i); end

N,M,P,Q = ascan

n = N

i = 1
loop do
    n -= M
    n -= M if P-1 <= (i-1)%12 && (i-1)%12 <= P+Q-2
    if n <= 0
        p i
        exit
    end
    i += 1
end
0