結果
問題 | No.45 回転寿司 |
ユーザー | komkomh |
提出日時 | 2019-04-04 15:58:45 |
言語 | Kotlin (1.9.23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 539 bytes |
コンパイル時間 | 11,689 ms |
コンパイル使用メモリ | 416,164 KB |
実行使用メモリ | 94,380 KB |
最終ジャッジ日時 | 2023-08-13 01:33:04 |
合計ジャッジ時間 | 24,240 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
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 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
コンパイルメッセージ
Main.kt:2:9: warning: variable 'N' is never used val N: Int = readLine()!!.toInt() ^
ソースコード
fun main() { val N: Int = readLine()!!.toInt() val V: List<Int> = readLine()!!.split(" ").map(String::toInt) fun getMaxOishisa(i: Int): Int { if (i >= V.size) { return 0 } val currentOishisa = if (i < 0) 0 else V[i] val oishisa1 = getMaxOishisa(i + 2) val oishisa2 = getMaxOishisa(i + 3) return when (oishisa1 > oishisa2) { true -> oishisa1 + currentOishisa false -> oishisa2 + currentOishisa } } println(getMaxOishisa(-2)) }