結果

問題 No.45 回転寿司
ユーザー komkomhkomkomh
提出日時 2019-04-04 17:59:13
言語 Kotlin
(1.9.10)
結果
AC  
実行時間 330 ms / 5,000 ms
コード長 410 bytes
コンパイル時間 12,769 ms
コンパイル使用メモリ 418,672 KB
実行使用メモリ 57,556 KB
最終ジャッジ日時 2023-08-13 01:33:34
合計ジャッジ時間 25,311 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 323 ms
57,064 KB
testcase_01 AC 327 ms
57,024 KB
testcase_02 AC 327 ms
57,028 KB
testcase_03 AC 328 ms
57,192 KB
testcase_04 AC 323 ms
56,852 KB
testcase_05 AC 316 ms
57,288 KB
testcase_06 AC 325 ms
56,960 KB
testcase_07 AC 324 ms
56,892 KB
testcase_08 AC 319 ms
57,528 KB
testcase_09 AC 328 ms
57,428 KB
testcase_10 AC 330 ms
57,048 KB
testcase_11 AC 318 ms
57,112 KB
testcase_12 AC 329 ms
57,032 KB
testcase_13 AC 310 ms
57,224 KB
testcase_14 AC 309 ms
57,132 KB
testcase_15 AC 321 ms
57,072 KB
testcase_16 AC 318 ms
57,000 KB
testcase_17 AC 319 ms
57,008 KB
testcase_18 AC 320 ms
57,556 KB
testcase_19 AC 325 ms
57,024 KB
testcase_20 AC 317 ms
57,148 KB
testcase_21 AC 313 ms
57,052 KB
testcase_22 AC 309 ms
57,112 KB
testcase_23 AC 314 ms
56,884 KB
testcase_24 AC 317 ms
57,156 KB
testcase_25 AC 314 ms
56,916 KB
testcase_26 AC 323 ms
57,072 KB
testcase_27 AC 327 ms
57,192 KB
testcase_28 AC 327 ms
57,268 KB
testcase_29 AC 327 ms
57,080 KB
testcase_30 AC 323 ms
57,360 KB
testcase_31 AC 309 ms
56,884 KB
testcase_32 AC 309 ms
56,972 KB
testcase_33 AC 325 ms
56,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main() {
    readLine()!!.toInt()
    var V: IntArray = readLine()!!.split(" ").map(String::toInt).toIntArray()

    fun getMinusValue(targetIndex: Int): Int = if (targetIndex < 0) 0 else V[targetIndex]

    for (i in (0 until V.size)) {
        val minus2 = getMinusValue(i - 2)
        val minus3 = getMinusValue(i - 3)
        V[i] += if (minus2 > minus3) minus2 else minus3
    }
    println(V.max())
}
0