結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
mofu
|
| 提出日時 | 2015-03-16 01:51:04 |
| 言語 | PHP (8.5.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 511 bytes |
| 記録 | |
| コンパイル時間 | 77 ms |
| コンパイル使用メモリ | 37,660 KB |
| 実行使用メモリ | 38,040 KB |
| 最終ジャッジ日時 | 2026-03-18 05:10:04 |
| 合計ジャッジ時間 | 2,510 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 34 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
$box_width = trim(fgets(STDIN));
$block_num = trim(fgets(STDIN));
$block_width_array = explode(" ", fgets(STDIN));
$block_width_array = str_replace(array("\r\n", "\r", "\n"), "", $block_width_array);
//echo $box_width."\n";
//echo $block_num."\n";
//print_r($block_width_array);
sort($block_width_array);
//print_r($block_width_array);
$result = 0;
$count = 0;
for($i=0; $i<$block_num; $i++){
$result += $block_width_array[$i];
if($result > $box_width){
break;
}
$count++;
}
echo $count;
mofu