結果

問題 No.2203 POWER!!!!!
ユーザー 👑 箱星箱星
提出日時 2022-08-30 03:23:40
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 532 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 13,942 ms
コンパイル使用メモリ 418,400 KB
実行使用メモリ 68,452 KB
最終ジャッジ日時 2023-09-15 16:11:35
合計ジャッジ時間 22,021 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 294 ms
52,904 KB
testcase_01 AC 299 ms
52,968 KB
testcase_02 AC 304 ms
53,040 KB
testcase_03 AC 295 ms
53,012 KB
testcase_04 AC 293 ms
53,060 KB
testcase_05 AC 298 ms
52,800 KB
testcase_06 AC 297 ms
53,024 KB
testcase_07 AC 294 ms
52,792 KB
testcase_08 AC 390 ms
56,044 KB
testcase_09 AC 462 ms
57,792 KB
testcase_10 AC 504 ms
57,808 KB
testcase_11 AC 513 ms
66,068 KB
testcase_12 AC 392 ms
56,340 KB
testcase_13 AC 525 ms
68,120 KB
testcase_14 AC 527 ms
68,132 KB
testcase_15 AC 528 ms
68,452 KB
testcase_16 AC 527 ms
68,300 KB
testcase_17 AC 532 ms
68,032 KB
testcase_18 AC 296 ms
52,764 KB
testcase_19 AC 292 ms
52,996 KB
testcase_20 AC 291 ms
53,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:10:9: warning: variable 'n' is never used
    val n = readInt()
        ^

ソースコード

diff #

fun pow(a: Int, b: Int): Long {
    var ret = 1L
    repeat(b) {
        ret *= a
    }
    return ret
}

fun main() {
    val n = readInt()
    val a = readInts()
    val counter = Array(9) { 0L }
    for (v in a) {
        counter[v]++
    }
    var ans = 0L
    for (b in 1..8) {
        for (e in 1..8) {
            ans += counter[b] * counter[e] * pow(b, e)
        }
    }
    println(ans)
}

fun readInt() = readln().toInt()
fun readInts() = readln().split(" ").map { it.toInt() }
0