結果

問題 No.5 数字のブロック
ユーザー oga00826oga00826
提出日時 2019-06-04 14:33:07
言語 PHP
(8.3.4)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 423 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 32,728 KB
実行使用メモリ 32,796 KB
最終ジャッジ日時 2023-10-17 23:43:19
合計ジャッジ時間 2,828 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
32,736 KB
testcase_01 AC 44 ms
32,736 KB
testcase_02 AC 43 ms
32,736 KB
testcase_03 AC 55 ms
32,796 KB
testcase_04 AC 47 ms
32,796 KB
testcase_05 AC 50 ms
32,796 KB
testcase_06 AC 48 ms
32,796 KB
testcase_07 AC 47 ms
32,796 KB
testcase_08 AC 48 ms
32,796 KB
testcase_09 AC 45 ms
32,796 KB
testcase_10 AC 50 ms
32,796 KB
testcase_11 AC 47 ms
32,796 KB
testcase_12 AC 47 ms
32,796 KB
testcase_13 AC 49 ms
32,796 KB
testcase_14 AC 43 ms
32,796 KB
testcase_15 AC 43 ms
32,796 KB
testcase_16 AC 50 ms
32,796 KB
testcase_17 AC 51 ms
32,796 KB
testcase_18 AC 51 ms
32,796 KB
testcase_19 AC 51 ms
32,796 KB
testcase_20 AC 43 ms
32,736 KB
testcase_21 AC 43 ms
32,796 KB
testcase_22 AC 43 ms
32,736 KB
testcase_23 AC 44 ms
32,796 KB
testcase_24 AC 44 ms
32,796 KB
testcase_25 AC 44 ms
32,796 KB
testcase_26 AC 42 ms
32,736 KB
testcase_27 AC 42 ms
32,736 KB
testcase_28 AC 43 ms
32,736 KB
testcase_29 AC 47 ms
32,796 KB
testcase_30 AC 44 ms
32,796 KB
testcase_31 AC 43 ms
32,736 KB
testcase_32 AC 43 ms
32,736 KB
testcase_33 AC 43 ms
32,736 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

$hako_width = trim(fgets(STDIN));
$block_quantity = trim(fgets(STDIN));
$block_width_array = explode(" ", trim(fgets(STDIN)));

sort( $block_width_array, SORT_ASC ) ;

$count = 0;
$all_width = $hako_width;
foreach ($block_width_array as $block_width) {
    $count++;
    $result = $all_width - $block_width;
    if ($result < 0) {
        $count--;
        break;
    }
    $all_width = $result;
}

echo $count."\n";
0