結果

問題 No.804 野菜が苦手
ユーザー osakana666666osakana666666
提出日時 2019-04-21 13:34:08
言語 PHP
(8.3.4)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 578 bytes
コンパイル時間 2,111 ms
コンパイル使用メモリ 32,276 KB
実行使用メモリ 31,368 KB
最終ジャッジ日時 2024-04-15 14:40:11
合計ジャッジ時間 3,772 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
31,100 KB
testcase_01 AC 43 ms
31,124 KB
testcase_02 AC 41 ms
31,368 KB
testcase_03 AC 42 ms
30,928 KB
testcase_04 AC 42 ms
30,976 KB
testcase_05 AC 41 ms
31,096 KB
testcase_06 AC 41 ms
31,272 KB
testcase_07 AC 41 ms
31,172 KB
testcase_08 AC 41 ms
31,196 KB
testcase_09 AC 41 ms
30,720 KB
testcase_10 AC 42 ms
30,872 KB
testcase_11 AC 41 ms
30,776 KB
testcase_12 AC 42 ms
31,080 KB
testcase_13 AC 42 ms
30,940 KB
testcase_14 AC 42 ms
30,848 KB
testcase_15 AC 41 ms
31,064 KB
testcase_16 AC 42 ms
31,188 KB
testcase_17 AC 41 ms
31,220 KB
testcase_18 AC 42 ms
31,092 KB
testcase_19 AC 40 ms
31,292 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$array = trim(fgets(STDIN));
$input = explode(" ", $array);
$vegitable = $input[0];
$meat = $input[1];
$multiple = $input[2];
$max = $input[3];

for($answer=0;$answer<=$vegitable;$answer++) {
        //必要なお肉の数
        $need_meat = ($answer*$multiple);
        //お肉の数が必要なお肉の数より少ない場合
        if($meat < $need_meat) {
            break;
        }
        //お肉+野菜が最大の食べれる量以上になったら
        else if($need_meat+$answer > $max) {
            break;
        }
}
echo ($answer-1).PHP_EOL;
?>
0