結果

問題 No.156 キャンディー・ボックス
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-14 16:12:28
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 314 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 32,020 KB
実行使用メモリ 32,396 KB
最終ジャッジ日時 2024-04-16 19:48:29
合計ジャッジ時間 2,629 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 42 ms
30,896 KB
testcase_03 AC 41 ms
30,820 KB
testcase_04 AC 40 ms
30,764 KB
testcase_05 WA -
testcase_06 AC 41 ms
30,720 KB
testcase_07 AC 40 ms
30,648 KB
testcase_08 AC 41 ms
30,848 KB
testcase_09 AC 39 ms
30,820 KB
testcase_10 AC 39 ms
30,952 KB
testcase_11 AC 40 ms
30,832 KB
testcase_12 AC 38 ms
30,872 KB
testcase_13 AC 39 ms
30,720 KB
testcase_14 AC 39 ms
30,800 KB
testcase_15 AC 39 ms
30,848 KB
testcase_16 AC 41 ms
30,880 KB
testcase_17 AC 40 ms
30,940 KB
testcase_18 WA -
testcase_19 AC 40 ms
30,896 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 40 ms
30,904 KB
testcase_24 AC 41 ms
30,728 KB
testcase_25 AC 41 ms
30,976 KB
testcase_26 AC 40 ms
30,828 KB
testcase_27 AC 41 ms
30,740 KB
testcase_28 WA -
testcase_29 AC 39 ms
30,828 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 40 ms
30,768 KB
testcase_33 AC 39 ms
31,000 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$array = explode(" ", trim(fgets(STDIN)));
$N = $array[0];
$M = $array[1];
$candy = explode(" ", trim(fgets(STDIN)));
$ans = 0;
for($i = 0; $i < $N; $i++) {
  $c = $candy[$i];
  if($c > $M) {
    break;
  } else if($c == $M) {
    $ans++;
    break;
  } else {
    $M -= $c;
    $ans++;
  }
}
print($ans);
?>
0