結果

問題 No.5 数字のブロック
コンテスト
ユーザー Ruizi_Luigi
提出日時 2015-07-24 11:26:10
言語 PHP
(8.5.2)
コンパイル:
php -l _filename_
実行:
php _filename_
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 263 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 346 ms
コンパイル使用メモリ 38,000 KB
実行使用メモリ 38,424 KB
最終ジャッジ日時 2026-02-28 06:16:44
合計ジャッジ時間 4,282 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
PHP Deprecated:  Non-canonical cast (integer) is deprecated, use the (int) cast instead in Main.php on line 9

Deprecated: Non-canonical cast (integer) is deprecated, use the (int) cast instead in Main.php on line 9
PHP Deprecated:  Non-canonical cast (integer) is deprecated, use the (int) cast instead in Main.php on line 11

Deprecated: Non-canonical cast (integer) is deprecated, use the (int) cast instead in Main.php on line 11
No syntax errors detected in Main.php

ソースコード

diff #
raw source code

<?php

    $l = trim(fgets(STDIN));
    $n = trim(fgets(STDIN));
    $w = explode(' ', trim(fgets(STDIN)));
    sort($w);

    $sum = 0;
    for ($i = 0; $i < (integer)$n; $i++) {
    	$sum += $w[$i];
    	if ($sum > (integer)$l) break;
    }

    echo $i . "\n";
0