結果

問題 No.1686 Geschenkt
ユーザー SKSK
提出日時 2022-12-29 15:23:59
言語 PHP
(8.3.4)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 199 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 18,432 KB
実行使用メモリ 18,756 KB
最終ジャッジ日時 2023-08-16 06:28:44
合計ジャッジ時間 964 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
18,620 KB
testcase_01 AC 16 ms
18,572 KB
testcase_02 AC 16 ms
18,752 KB
testcase_03 AC 16 ms
18,688 KB
testcase_04 AC 16 ms
18,644 KB
testcase_05 AC 15 ms
18,508 KB
testcase_06 AC 15 ms
18,716 KB
testcase_07 AC 15 ms
18,716 KB
testcase_08 AC 15 ms
18,736 KB
testcase_09 AC 15 ms
18,756 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$n = trim(fgets(STDIN));
$a = explode(" ",trim(fgets(STDIN)));

sort($a);
$ans = $a[0];

for($i = 1;$i <= $n;$i++){
    if($a[$i]-$a[$i-1] !== 1){
        $ans += $a[$i];
    }
}

echo $ans;
?>
0