結果

問題 No.2203 POWER!!!!!
ユーザー 👑 箱星箱星
提出日時 2022-02-16 20:20:17
言語 Kotlin
(1.9.23)
結果
TLE  
実行時間 -
コード長 1,076 bytes
コンパイル時間 20,920 ms
コンパイル使用メモリ 422,164 KB
実行使用メモリ 59,368 KB
最終ジャッジ日時 2023-09-15 16:04:12
合計ジャッジ時間 21,271 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 267 ms
52,540 KB
testcase_01 AC 266 ms
54,252 KB
testcase_02 AC 266 ms
52,788 KB
testcase_03 AC 270 ms
54,224 KB
testcase_04 AC 270 ms
54,352 KB
testcase_05 AC 273 ms
54,400 KB
testcase_06 AC 272 ms
53,080 KB
testcase_07 AC 270 ms
52,256 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

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

fun PrintWriter.solve() {
    val n = nextInt()
    val a = Array(n) { nextInt() }
    var ans = 0L
    for (i in 0 until n) {
        for (j in 0 until n) {
            ans += pow(a[i], a[j])
        }
    }
    println(ans)
}

fun main() {
    Thread(null, {
        val writer = PrintWriter(System.out, false)
        writer.solve()
        writer.flush()
    }, "solve", abs(1L.shl(26)))
        .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
        .apply { start() }.join()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()
fun nextDouble() = next().toDouble()
// endregion
0