結果

問題 No.1389 Clumsy Calculation
ユーザー tzyvrntzyvrn
提出日時 2021-02-12 23:06:20
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 1,054 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 14,190 ms
コンパイル使用メモリ 420,400 KB
実行使用メモリ 70,644 KB
最終ジャッジ日時 2023-09-27 06:23:08
合計ジャッジ時間 39,916 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 340 ms
53,876 KB
testcase_01 AC 339 ms
54,096 KB
testcase_02 AC 341 ms
54,084 KB
testcase_03 AC 482 ms
57,876 KB
testcase_04 AC 466 ms
58,128 KB
testcase_05 AC 480 ms
58,216 KB
testcase_06 AC 478 ms
57,864 KB
testcase_07 AC 473 ms
58,136 KB
testcase_08 AC 336 ms
53,800 KB
testcase_09 AC 1,054 ms
69,084 KB
testcase_10 AC 883 ms
69,596 KB
testcase_11 AC 491 ms
58,008 KB
testcase_12 AC 492 ms
58,108 KB
testcase_13 AC 473 ms
57,572 KB
testcase_14 AC 1,015 ms
68,484 KB
testcase_15 AC 1,022 ms
68,716 KB
testcase_16 AC 1,033 ms
68,872 KB
testcase_17 AC 1,022 ms
68,960 KB
testcase_18 AC 1,019 ms
69,076 KB
testcase_19 AC 999 ms
68,708 KB
testcase_20 AC 997 ms
70,644 KB
testcase_21 AC 1,022 ms
68,532 KB
testcase_22 AC 1,020 ms
68,840 KB
testcase_23 AC 1,021 ms
68,656 KB
testcase_24 AC 1,015 ms
70,500 KB
testcase_25 AC 1,017 ms
69,400 KB
testcase_26 AC 982 ms
68,804 KB
testcase_27 AC 1,013 ms
68,872 KB
testcase_28 AC 1,011 ms
70,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val x = sc.nextLong()
    val s = List(n) { sc.nextLong() }

    val a = MutableList<Long>(n) { 0 }
    for (i in 0 until n) {
        a[i] = x - s[i]
    }

    val t = a.sum()
    for (i in 0 until n) {
        if (s[i] % 2L == 1L) {
            continue
        }

        val now = t - a[i] + (x - s[i] / 2)
        if (now == x) {
            println(s[i] / 2)
            return
        }
    }
}

fun eprintln(obj: Any) = System.err.println(obj.toString())
0