結果

問題 No.23 技の選択
ユーザー hirogahiroga
提出日時 2020-01-13 14:33:36
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 761 bytes
コンパイル時間 16,295 ms
コンパイル使用メモリ 427,876 KB
実行使用メモリ 54,592 KB
最終ジャッジ日時 2023-08-22 18:12:56
合計ジャッジ時間 25,374 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 308 ms
52,908 KB
testcase_01 AC 308 ms
52,992 KB
testcase_02 AC 309 ms
52,724 KB
testcase_03 AC 309 ms
53,108 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 309 ms
52,800 KB
testcase_07 AC 314 ms
52,948 KB
testcase_08 AC 311 ms
52,832 KB
testcase_09 AC 307 ms
52,868 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 309 ms
52,836 KB
testcase_13 WA -
testcase_14 AC 308 ms
52,968 KB
testcase_15 AC 306 ms
52,868 KB
testcase_16 AC 304 ms
53,096 KB
testcase_17 AC 307 ms
52,928 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 306 ms
52,816 KB
testcase_21 AC 310 ms
52,960 KB
testcase_22 AC 303 ms
52,932 KB
testcase_23 AC 305 ms
52,824 KB
testcase_24 AC 304 ms
52,876 KB
testcase_25 AC 305 ms
52,944 KB
testcase_26 AC 306 ms
52,732 KB
testcase_27 AC 306 ms
52,820 KB
testcase_28 AC 305 ms
52,744 KB
testcase_29 AC 304 ms
52,796 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:21:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^

ソースコード

diff #

private const val SPECIAL_ATTACK_NUM_EXPECTED = 1.5

internal fun solve(HP: Int, normal: Int, special: Int): String {
    fun attackUntilYouDie(currentHP: Double): Double {
        return when {
            currentHP <= 0 -> {
                0.0
            }
            currentHP <= normal -> {
                1.0
            }
            else -> {
                SPECIAL_ATTACK_NUM_EXPECTED + attackUntilYouDie(currentHP - special)
            }
        }
    }
    return attackUntilYouDie(HP.toDouble()).toString()
}

fun main(args: Array<String>) {
    var OUTPUT = ""

    val br = System.`in`.bufferedReader()
    val (HP, normal, special) = br.readLine().split(" ").map { it.toInt() }

    OUTPUT += solve(HP, normal, special)
    print(OUTPUT)
}
0