結果

問題 No.69 文字を自由に並び替え
ユーザー rutilicusrutilicus
提出日時 2020-08-30 22:10:52
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 324 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 12,240 ms
コンパイル使用メモリ 432,304 KB
実行使用メモリ 56,828 KB
最終ジャッジ日時 2024-04-27 13:31:09
合計ジャッジ時間 17,184 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 312 ms
56,732 KB
testcase_01 AC 315 ms
56,828 KB
testcase_02 AC 318 ms
56,668 KB
testcase_03 AC 316 ms
56,756 KB
testcase_04 AC 324 ms
56,808 KB
testcase_05 AC 316 ms
56,704 KB
testcase_06 AC 314 ms
56,656 KB
testcase_07 AC 309 ms
56,700 KB
testcase_08 AC 322 ms
56,688 KB
testcase_09 AC 321 ms
56,784 KB
testcase_10 AC 313 ms
56,752 KB
testcase_11 AC 318 ms
56,780 KB
testcase_12 AC 316 ms
56,608 KB
testcase_13 AC 313 ms
56,740 KB
testcase_14 AC 320 ms
56,768 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