結果

問題 No.745 letinopia raoha
ユーザー 14番14番
提出日時 2022-07-06 10:01:42
言語 Kotlin
(1.9.10)
結果
AC  
実行時間 297 ms / 2,000 ms
コード長 902 bytes
コンパイル時間 15,310 ms
コンパイル使用メモリ 422,240 KB
実行使用メモリ 53,232 KB
最終ジャッジ日時 2023-08-23 06:15:23
合計ジャッジ時間 18,790 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 292 ms
52,760 KB
testcase_01 AC 293 ms
52,740 KB
testcase_02 AC 287 ms
52,656 KB
testcase_03 AC 289 ms
53,232 KB
testcase_04 AC 294 ms
53,000 KB
testcase_05 AC 290 ms
53,000 KB
testcase_06 AC 292 ms
52,724 KB
testcase_07 AC 294 ms
52,996 KB
testcase_08 AC 291 ms
52,752 KB
testcase_09 AC 297 ms
52,832 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:11:14: warning: variable 'c' is never used
    val (a,b,c,d) = readLine()!!.split(" ").map { it.toInt() }
             ^

ソースコード

diff #

fun main(args: Array<String>) {
    getAns()?.also {
        println("Possible")
        println(it)
    }?:run {
        println("Impossible")
    }
}

fun getAns():Long? {
    val (a,b,c,d) = readLine()!!.split(" ").map { it.toInt() }
    if(d >= 10) {
        return null
    }
    var adj = 1L
    var remainB = b
    var remainA = a
    var remainCombo = 100
    var score = 0L
    while (remainB > 0) {
        val add = Math.min(remainCombo, remainB)
        score += add*50*adj
        remainCombo -= add
        remainB -= add
        if(remainCombo <= 0) {
            adj*=2
            remainCombo = 100
        }
    }
    while (remainA > 0) {
        val add = Math.min(remainCombo, remainA)
        score += add*100*adj
        remainCombo -= add
        remainA -= add
        if(remainCombo <= 0) {
            adj *= 2
            remainCombo = 100
        }
    }
    return score
}
0