結果

問題 No.1389 Clumsy Calculation
ユーザー rutilicusrutilicus
提出日時 2021-02-21 22:56:49
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 704 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 15,530 ms
コンパイル使用メモリ 432,956 KB
実行使用メモリ 70,236 KB
最終ジャッジ日時 2023-10-19 23:51:12
合計ジャッジ時間 32,255 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 348 ms
54,448 KB
testcase_01 AC 345 ms
54,456 KB
testcase_02 AC 347 ms
54,440 KB
testcase_03 AC 411 ms
54,764 KB
testcase_04 AC 414 ms
54,760 KB
testcase_05 AC 416 ms
54,728 KB
testcase_06 AC 418 ms
54,764 KB
testcase_07 AC 432 ms
54,768 KB
testcase_08 AC 348 ms
54,456 KB
testcase_09 AC 704 ms
70,164 KB
testcase_10 AC 618 ms
66,068 KB
testcase_11 AC 402 ms
54,744 KB
testcase_12 AC 388 ms
54,744 KB
testcase_13 AC 393 ms
54,740 KB
testcase_14 AC 657 ms
70,196 KB
testcase_15 AC 639 ms
70,212 KB
testcase_16 AC 636 ms
70,176 KB
testcase_17 AC 638 ms
70,192 KB
testcase_18 AC 645 ms
70,228 KB
testcase_19 AC 646 ms
70,220 KB
testcase_20 AC 642 ms
70,192 KB
testcase_21 AC 642 ms
70,192 KB
testcase_22 AC 650 ms
70,236 KB
testcase_23 AC 641 ms
70,180 KB
testcase_24 AC 639 ms
70,196 KB
testcase_25 AC 636 ms
70,160 KB
testcase_26 AC 632 ms
70,196 KB
testcase_27 AC 636 ms
70,196 KB
testcase_28 AC 646 ms
70,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    val (n, x) = readInputLine().split(" ").map { it.toLong() }
    val sArr = readInputLine().split(" ").map { it.toLong() }
    val sSum = sArr.sum()

    val wrongA = n * x - sSum

    for (s in sArr) {
        if (s % 2L != 0L) {
            continue
        }
        if (s / 2L + wrongA == x) {
            builder.appendLine(s / 2L)
            break
        }
    }

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0