結果

問題 No.5 数字のブロック
ユーザー PcclaPccla
提出日時 2017-07-13 01:14:28
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 406 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 30,904 KB
実行使用メモリ 31,884 KB
最終ジャッジ日時 2024-04-16 17:55:02
合計ジャッジ時間 2,641 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
31,092 KB
testcase_01 AC 43 ms
31,208 KB
testcase_02 AC 44 ms
31,220 KB
testcase_03 AC 49 ms
31,376 KB
testcase_04 AC 45 ms
31,324 KB
testcase_05 WA -
testcase_06 AC 45 ms
31,304 KB
testcase_07 AC 44 ms
31,376 KB
testcase_08 AC 46 ms
31,372 KB
testcase_09 AC 43 ms
31,124 KB
testcase_10 AC 49 ms
31,884 KB
testcase_11 AC 44 ms
31,252 KB
testcase_12 AC 47 ms
31,412 KB
testcase_13 AC 48 ms
31,500 KB
testcase_14 AC 40 ms
31,220 KB
testcase_15 WA -
testcase_16 AC 47 ms
31,372 KB
testcase_17 AC 49 ms
31,500 KB
testcase_18 AC 50 ms
31,884 KB
testcase_19 AC 49 ms
31,760 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 41 ms
31,308 KB
testcase_24 AC 42 ms
31,164 KB
testcase_25 AC 41 ms
31,228 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$box_length = trim(fgets(STDIN));
$block_num = trim(fgets(STDIN));
$block = trim(fgets(STDIN));

$block_arr = explode(" ", $block);
$block_arr_sort = sort($block_arr);

$block_length = $block_arr[0];

if ($block_arr[0] >= $box_length)
{
	echo 1;
}
else
{
	for ($i = 1; $i < $block_num; $i++)
	{
		$block_length += $block_arr[$i];
		if ($block_length >= $box_length)
		{
			echo $i;
			break;
		}
	}
}
0