結果

問題 No.740 幻の木
ユーザー PicklesSuperiorPicklesSuperior
提出日時 2018-10-19 23:02:20
言語 PHP
(8.3.4)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 3,033 ms
コンパイル使用メモリ 31,888 KB
実行使用メモリ 31,424 KB
最終ジャッジ日時 2024-04-29 16:48:02
合計ジャッジ時間 3,953 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
31,048 KB
testcase_01 AC 32 ms
31,424 KB
testcase_02 AC 34 ms
31,204 KB
testcase_03 AC 33 ms
31,012 KB
testcase_04 AC 32 ms
31,288 KB
testcase_05 AC 32 ms
31,164 KB
testcase_06 AC 106 ms
31,164 KB
testcase_07 AC 34 ms
31,192 KB
testcase_08 AC 34 ms
31,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
    $input = preg_split('/ /',fgets(STDIN));
    $leaves = $input[0];
    $fall_number = $input[1];
    $start_month = $input[2];
    $wind_period = $input[3];
    $end_month = $start_month + $wind_period - 1;
    $count = 0;
    $this_month = 1;

    while($leaves > 0){
        $count += 1;
        if($start_month <= $this_month && $this_month <= $end_month){
            $leaves -= $fall_number*2;
        }else{
            $leaves -= $fall_number;
        }
        if($this_month == 12){
            $this_month = 1;
        }else{
            $this_month++; 
        }
    }
    print $count . "\n";
?>
0