結果

問題 No.3072 Sum of sqrt(x)
ユーザー matsumomatsumo
提出日時 2020-11-14 23:08:05
言語 Kotlin
(1.9.23)
結果
TLE  
実行時間 -
コード長 965 bytes
コンパイル時間 15,688 ms
コンパイル使用メモリ 425,124 KB
実行使用メモリ 70,744 KB
最終ジャッジ日時 2023-09-30 06:40:51
合計ジャッジ時間 29,299 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 244 ms
50,304 KB
testcase_01 AC 243 ms
50,364 KB
testcase_02 AC 245 ms
50,644 KB
testcase_03 AC 243 ms
50,352 KB
testcase_04 AC 241 ms
50,348 KB
testcase_05 AC 241 ms
50,344 KB
testcase_06 AC 244 ms
50,536 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.math.MathContext
import kotlin.math.sqrt

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use {
        out.use {
//        repeat(readInteger()) { solve() }
            solve()
            out.flush()
        }
    }
}

fun solve() {
    val n = readInteger()
    var ans = 0.0.toBigDecimal()
    repeat(n) {
        val x = readLong().toBigDecimal().sqrt(MathContext.DECIMAL64)!!
        ans += x
        out.println(ans)
    }
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)
0