結果

問題 No.740 幻の木
コンテスト
ユーザー PicklesSuperior
提出日時 2018-10-19 23:02:20
言語 PHP
(8.5.11)
コンパイル:
php -l _filename_
実行:
php _filename_
結果
AC  
実行時間 96 ms / 2,000 ms
+ 827µs
コード長 616 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,268 ms
コンパイル使用メモリ 37,256 KB
実行使用メモリ 38,276 KB
最終ジャッジ日時 2026-10-14 20:43:10
合計ジャッジ時間 4,825 ms
ジャッジサーバーID
(参考情報)
judge6_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #
raw source code

<?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