結果

問題 No.1046 Fruits Rush
ユーザー SKSK
提出日時 2022-12-20 15:49:30
言語 PHP
(8.3.4)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 225 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 30,828 KB
実行使用メモリ 31,260 KB
最終ジャッジ日時 2024-04-29 02:49:54
合計ジャッジ時間 1,438 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
31,260 KB
testcase_01 AC 45 ms
30,884 KB
testcase_02 AC 43 ms
31,024 KB
testcase_03 AC 40 ms
30,968 KB
testcase_04 AC 41 ms
31,064 KB
testcase_05 AC 40 ms
30,924 KB
testcase_06 AC 44 ms
30,952 KB
testcase_07 AC 41 ms
30,948 KB
testcase_08 AC 41 ms
30,756 KB
testcase_09 AC 39 ms
31,024 KB
testcase_10 AC 40 ms
30,924 KB
testcase_11 AC 40 ms
30,940 KB
testcase_12 AC 41 ms
31,172 KB
testcase_13 AC 40 ms
30,960 KB
testcase_14 AC 40 ms
30,968 KB
testcase_15 AC 41 ms
31,084 KB
testcase_16 AC 41 ms
30,916 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
[$n,$k] = explode(" ",trim(fgets(STDIN)));
$count = 0;
$a = explode(" ",trim(fgets(STDIN)));

rsort($a);

$count += $a[0];
for($i = 1;$k > $i;$i++){
    if($a[$i] > 0){
        $count += $a[$i];
    }
}

echo $count;
?>
0