結果

問題 No.1225 I hate I hate Matrix Construction
ユーザー rutilicus
提出日時 2020-09-12 11:57:39
言語 Kotlin
(2.1.0)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 13,837 ms
コンパイル使用メモリ 435,504 KB
実行使用メモリ 57,016 KB
最終ジャッジ日時 2024-12-31 14:15:18
合計ジャッジ時間 25,390 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:29:13: warning: 'appendln(Int): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
    builder.appendln(max(rowCnt, colCnt))
            ^

ソースコード

diff #

import kotlin.math.max

fun main() {
    val builder = StringBuilder()

    val n = readInputLine().toInt()

    val s = readInputLine()
    val t = readInputLine()

    var rowCnt = 0

    for (c in s) {
        when (c) {
            '1' -> rowCnt++
            '2' -> rowCnt += n
        }
    }

    var colCnt = 0

    for (c in t) {
        when (c) {
            '1' -> colCnt++
            '2' -> colCnt += n
        }
    }

    builder.appendln(max(rowCnt, colCnt))

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0