結果

問題 No.804 野菜が苦手
コンテスト
ユーザー harhogefoo
提出日時 2019-04-07 23:22:27
言語 PHP
(843.2)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 502 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,674 ms
コンパイル使用メモリ 36,116 KB
実行使用メモリ 36,504 KB
最終ジャッジ日時 2025-12-06 14:48:30
合計ジャッジ時間 2,267 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #
raw source code

<?php
  list($vegCount, $meatCount, $reg, $max) = explode(" ", trim(fgets(STDIN)));

  $maxVegCount = $vegCount;
  if ($max < $vegCount) {
    $maxVegCount = $max;
  }

  $ateVegCount = 0;
  for ($currentVegCount = $maxVegCount; $currentVegCount >= 0; $currentVegCount--) {
    $currentMeatCount = $currentVegCount * $reg;
    if ($currentMeatCount <= $meatCount && $currentMeatCount + $currentVegCount <= $max) {
      $ateVegCount = $currentVegCount;
      break;
    }
  }

  printf("$ateVegCount");
0