結果

問題 No.933 おまわりさんこいつです
ユーザー rutilicusrutilicus
提出日時 2021-02-13 22:02:14
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 591 ms / 2,000 ms
コード長 449 bytes
コンパイル時間 13,102 ms
コンパイル使用メモリ 419,004 KB
実行使用メモリ 64,256 KB
最終ジャッジ日時 2023-09-28 07:40:21
合計ジャッジ時間 23,863 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 293 ms
52,800 KB
testcase_01 AC 293 ms
52,940 KB
testcase_02 AC 301 ms
53,000 KB
testcase_03 AC 294 ms
52,992 KB
testcase_04 AC 291 ms
52,868 KB
testcase_05 AC 309 ms
53,068 KB
testcase_06 AC 309 ms
53,064 KB
testcase_07 AC 308 ms
52,852 KB
testcase_08 AC 301 ms
52,896 KB
testcase_09 AC 302 ms
52,932 KB
testcase_10 AC 312 ms
52,988 KB
testcase_11 AC 321 ms
53,080 KB
testcase_12 AC 318 ms
53,332 KB
testcase_13 AC 357 ms
53,284 KB
testcase_14 AC 369 ms
55,228 KB
testcase_15 AC 408 ms
53,424 KB
testcase_16 AC 472 ms
57,732 KB
testcase_17 AC 483 ms
57,716 KB
testcase_18 AC 312 ms
53,012 KB
testcase_19 AC 523 ms
64,008 KB
testcase_20 AC 481 ms
57,804 KB
testcase_21 AC 300 ms
52,892 KB
testcase_22 AC 291 ms
53,120 KB
testcase_23 AC 591 ms
64,256 KB
testcase_24 AC 571 ms
64,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    readInputLine()
    val pArr = readInputLine().split(" ").map { it.toLong() }

    if (pArr.contains(0L)) {
        builder.appendLine(0)
    } else {
        builder.appendLine(pArr.fold(1L) { acc, l -> root(acc * (l % 9L)) })
    }

    print(builder.toString())
}

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

fun root(a: Long): Long {
    return if (a % 9L != 0L) a % 9L else 9L
}
0