結果

問題 No.804 野菜が苦手
ユーザー harhogefoo
提出日時 2019-04-07 23:22:27
言語 PHP
(843.2)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 2,022 ms
コンパイル使用メモリ 30,836 KB
実行使用メモリ 31,312 KB
最終ジャッジ日時 2024-06-28 02:19:30
合計ジャッジ時間 2,003 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

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