結果

問題 No.69 文字を自由に並び替え
ユーザー rutilicusrutilicus
提出日時 2020-08-30 22:10:52
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 295 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 12,639 ms
コンパイル使用メモリ 411,884 KB
実行使用メモリ 52,888 KB
最終ジャッジ日時 2023-08-09 18:47:46
合計ジャッジ時間 18,609 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 292 ms
52,688 KB
testcase_01 AC 292 ms
52,580 KB
testcase_02 AC 292 ms
52,732 KB
testcase_03 AC 288 ms
52,580 KB
testcase_04 AC 291 ms
52,588 KB
testcase_05 AC 291 ms
52,832 KB
testcase_06 AC 289 ms
52,696 KB
testcase_07 AC 291 ms
52,876 KB
testcase_08 AC 289 ms
52,812 KB
testcase_09 AC 286 ms
52,756 KB
testcase_10 AC 287 ms
52,736 KB
testcase_11 AC 295 ms
52,888 KB
testcase_12 AC 292 ms
52,580 KB
testcase_13 AC 290 ms
52,688 KB
testcase_14 AC 293 ms
52,736 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:15:13: warning: 'appendln(String?): 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(if ((0..('z' - 'a')).all { aCnt[it] == bCnt[it] }) "YES" else "NO")
            ^

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    val aCnt = IntArray('z' - 'a' + 1)
    val bCnt = IntArray('z' - 'a' + 1)

    readInputLine().forEach {
        aCnt[it - 'a']++
    }

    readInputLine().forEach {
        bCnt[it - 'a']++
    }

    builder.appendln(if ((0..('z' - 'a')).all { aCnt[it] == bCnt[it] }) "YES" else "NO")

    print(builder.toString())
}

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