結果

問題 No.161 制限ジャンケン
ユーザー バカらっくバカらっく
提出日時 2019-11-12 03:38:16
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 15,769 ms
コンパイル使用メモリ 420,824 KB
実行使用メモリ 58,964 KB
最終ジャッジ日時 2023-10-14 11:01:25
合計ジャッジ時間 22,597 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 305 ms
57,052 KB
testcase_02 AC 312 ms
56,836 KB
testcase_03 AC 301 ms
57,264 KB
testcase_04 WA -
testcase_05 AC 305 ms
57,084 KB
testcase_06 AC 307 ms
57,452 KB
testcase_07 AC 303 ms
57,000 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'arr' is never used
fun main(arr:Array<String>) {
         ^

ソースコード

diff #

import java.util.*

fun main(arr:Array<String>) {
    val gcp = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
    val log = readLine()!!
    val gcp2 = listOf(log.count { it == 'G' }, log.count { it == 'C' }, log.count { it == 'P' }).toMutableList()
    var win = Math.min(gcp2[0], gcp[2])
    win += Math.min(gcp2[1], gcp[0])
    win += Math.min(gcp2[2], gcp[1])
    gcp[0] = Math.max(0, gcp[0] - gcp2[1])
    gcp[1] = Math.max(0, gcp[1] - gcp2[2])
    gcp[2] = Math.max(0, gcp[2] - gcp2[0])
    gcp2[0] = Math.max(0, gcp2[0] - gcp[2])
    gcp2[1] = Math.max(0, gcp2[1] - gcp[0])
    gcp2[2] = Math.max(0, gcp2[2] - gcp[1])
    var draw = Math.min(gcp[0], gcp2[0])
    draw += Math.min(gcp[1], gcp2[1])
    draw += Math.min(gcp[2], gcp2[2])
    val ans = win * 3 + draw
    println(ans)
}

0