結果

問題 No.1237 EXP Multiple!
ユーザー 👑 zeronosu77108zeronosu77108
提出日時 2021-02-10 18:45:04
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 599 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 13,276 ms
コンパイル使用メモリ 422,184 KB
実行使用メモリ 71,064 KB
最終ジャッジ日時 2023-09-22 13:48:09
合計ジャッジ時間 25,255 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 290 ms
52,964 KB
testcase_01 AC 573 ms
71,064 KB
testcase_02 AC 588 ms
70,696 KB
testcase_03 AC 598 ms
70,588 KB
testcase_04 AC 599 ms
70,596 KB
testcase_05 AC 509 ms
66,276 KB
testcase_06 AC 528 ms
66,340 KB
testcase_07 AC 509 ms
66,540 KB
testcase_08 AC 578 ms
68,696 KB
testcase_09 AC 512 ms
66,100 KB
testcase_10 AC 506 ms
66,128 KB
testcase_11 AC 520 ms
66,416 KB
testcase_12 AC 513 ms
66,368 KB
testcase_13 AC 545 ms
66,352 KB
testcase_14 AC 545 ms
66,284 KB
testcase_15 AC 544 ms
66,276 KB
testcase_16 AC 543 ms
66,292 KB
testcase_17 AC 540 ms
66,220 KB
testcase_18 AC 540 ms
66,228 KB
testcase_19 AC 513 ms
66,308 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:9: warning: variable 'n' is never used
    val n = readLine()!!.toInt()
        ^

ソースコード

diff #

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

    if (a.any { it >= 4 }) {
        println(1_000_000_007)
        return
    }

    if (a.any { it == 0L }) {
        println(-1)
        return
    }

    var pi = 1L
    for (ai in a) {
        val k = (1..ai).fold(1) { acc, x -> (acc * x).toInt() }
        for (i in 0 until k) {
            pi *= ai
            if (pi > 1_000_000_007) {
                println(1_000_000_007)
                return
            }

        }
    }

    println(1_000_000_007 % pi)
}
0