結果

問題 No.717 ファッションへのこだわり
ユーザー Pump0129Pump0129
提出日時 2018-08-19 12:29:16
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 293 ms / 2,000 ms
コード長 681 bytes
コンパイル時間 9,289 ms
コンパイル使用メモリ 430,728 KB
実行使用メモリ 57,000 KB
最終ジャッジ日時 2024-04-30 19:07:14
合計ジャッジ時間 13,626 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 256 ms
56,776 KB
testcase_01 AC 255 ms
56,752 KB
testcase_02 AC 270 ms
56,768 KB
testcase_03 AC 283 ms
56,736 KB
testcase_04 AC 261 ms
56,772 KB
testcase_05 AC 260 ms
56,764 KB
testcase_06 AC 269 ms
56,700 KB
testcase_07 AC 287 ms
56,964 KB
testcase_08 AC 285 ms
56,964 KB
testcase_09 AC 293 ms
56,836 KB
testcase_10 AC 285 ms
56,960 KB
testcase_11 AC 281 ms
56,816 KB
testcase_12 AC 290 ms
57,000 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:17:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:19:9: warning: variable 'numN' is never used
    val numN = numArray[0].toInt()
        ^
Main.kt:20:9: warning: variable 'numM' is never used
    val numM = numArray[1].toInt()
        ^

ソースコード

diff #

package net.ipipip0129.kotlin.yukicoder

import kotlin.math.min

fun abCount(charArray: CharArray): Array<Int> {
    var aCount = 0
    var bCount = 0
    charArray.forEach {
        when (it) {
            'A' -> aCount++
            'B' -> bCount++
        }
    }
    return arrayOf(aCount, bCount)
}

fun main(args: Array<String>) {
    val numArray = readLine()!!.split(" ")
    val numN = numArray[0].toInt()
    val numM = numArray[1].toInt()

    val sCountArray = abCount(readLine()!!.toCharArray())
    val tCountArray = abCount(readLine()!!.toCharArray())

    println(min(sCountArray[0], tCountArray[0]) + min(sCountArray[1], tCountArray[1]))
}
0