結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2015-07-24 11:21:59 |
言語 | PHP (843.2) |
結果 |
AC
|
実行時間 | 44 ms / 5,000 ms |
コード長 | 304 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 32,084 KB |
実行使用メモリ | 32,532 KB |
最終ジャッジ日時 | 2024-11-17 23:02:27 |
合計ジャッジ時間 | 2,050 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $l = trim(fgets(STDIN)); $n =trim(fgets(STDIN)); $w = explode(' ', trim(fgets(STDIN))); sort($w); $count = 0; $sum = 0; foreach ($w as $val) { $sum += $val; if ($sum > (integer)$l || $count >= (integer)$n) break; $count++; } echo $count . "\n";