結果

問題 No.1686 Geschenkt
ユーザー GatanityHouse
提出日時 2021-10-17 01:51:35
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 331 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 11,873 ms
コンパイル使用メモリ 431,056 KB
実行使用メモリ 60,188 KB
最終ジャッジ日時 2024-09-17 19:34:57
合計ジャッジ時間 15,456 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main() {
    readLine()
    val a = readLine()!!.split(" ").map { it.toInt() }

    val sortedAs = a.sorted()
    val result = sortedAs
        .filterIndexed { index, value ->
            val beforeValue = sortedAs.getOrNull(index - 1)

            if (beforeValue == null) true else {
                (value - beforeValue != 1)
            }
        }
        .sum()
    println(result)
}
0