結果

問題 No.5 数字のブロック
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-13 13:09:35
言語 PHP
(8.3.4)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 231 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 30,616 KB
実行使用メモリ 31,760 KB
最終ジャッジ日時 2024-04-29 09:14:59
合計ジャッジ時間 2,650 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
31,008 KB
testcase_01 AC 40 ms
30,824 KB
testcase_02 WA -
testcase_03 AC 46 ms
31,244 KB
testcase_04 AC 44 ms
31,120 KB
testcase_05 AC 47 ms
31,244 KB
testcase_06 AC 44 ms
31,248 KB
testcase_07 AC 44 ms
31,120 KB
testcase_08 AC 44 ms
31,248 KB
testcase_09 AC 41 ms
30,992 KB
testcase_10 AC 47 ms
31,756 KB
testcase_11 AC 43 ms
31,116 KB
testcase_12 AC 45 ms
31,248 KB
testcase_13 AC 46 ms
31,376 KB
testcase_14 AC 41 ms
30,852 KB
testcase_15 AC 42 ms
30,968 KB
testcase_16 AC 48 ms
31,372 KB
testcase_17 AC 48 ms
31,376 KB
testcase_18 AC 48 ms
31,760 KB
testcase_19 AC 49 ms
31,632 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 40 ms
30,732 KB
testcase_24 AC 42 ms
30,776 KB
testcase_25 AC 40 ms
30,704 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 43 ms
31,244 KB
testcase_30 AC 41 ms
31,276 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$L=fgets(STDIN);
$N=fgets(STDIN);
$args=explode(" ", trim(fgets(STDIN)));
sort($args);
$ans=0;
for($i=0;$i<$N;$i++) {
  $L-=$args[$i];
  if($L<0) {
    $ans=$i;
    break;
  }
}
if($L>=0) $ans=$N;
print($ans);
print("\n");
?>
0