結果

問題 No.1015 おつりは要らないです
ユーザー tomosuuu_outputtomosuuu_output
提出日時 2020-04-04 18:04:52
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 12,052 KB
実行使用メモリ 16,640 KB
最終ジャッジ日時 2023-09-16 06:01:31
合計ジャッジ時間 4,987 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
16,640 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 8 ms
12,352 KB
testcase_04 AC 11 ms
12,352 KB
testcase_05 AC 9 ms
12,320 KB
testcase_06 AC 8 ms
12,308 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
  $have = explode(" ",fgets(STDIN));
  $cost = explode(" ",fgets(STDIN));
  for ($i=0; $i < $have[0]; $i++){
      while ($cost[$i] > 0){
          $cost[$i] = pay($cost[$i]);
      }
  }
  
  if ($have[1] < 0){
      echo "No\n";
  } else {
      echo "Yes\n";
  }
  
  function pay($cost) {
      if ($have[3] > 0 && $have[2]*5000 + $have[1]*1000 < $cost){
          $have[3]--;
          $cost -= 10000;
      } else if ($have[2] > 0 && $have[1]*1000 < $cost){
          $have[2]--;
          $cost -= 5000;
      } else {
          $have[1]--;
          $cost -= 1000;
      }
      return $cost;
  }
?>
0