結果

問題 No.1455 拡張ROTN
ユーザー face4face4
提出日時 2021-04-10 23:14:53
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 805 bytes
コンパイル時間 15,203 ms
コンパイル使用メモリ 422,368 KB
実行使用メモリ 52,864 KB
最終ジャッジ日時 2023-09-09 03:15:10
合計ジャッジ時間 21,786 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 278 ms
52,356 KB
testcase_01 AC 277 ms
52,532 KB
testcase_02 AC 293 ms
52,492 KB
testcase_03 AC 288 ms
52,444 KB
testcase_04 AC 294 ms
52,784 KB
testcase_05 AC 283 ms
52,640 KB
testcase_06 AC 284 ms
52,484 KB
testcase_07 AC 283 ms
52,484 KB
testcase_08 AC 283 ms
52,468 KB
testcase_09 AC 273 ms
52,472 KB
testcase_10 AC 274 ms
52,452 KB
testcase_11 AC 273 ms
52,516 KB
testcase_12 AC 272 ms
52,592 KB
testcase_13 AC 271 ms
52,528 KB
testcase_14 AC 271 ms
52,740 KB
testcase_15 AC 274 ms
52,864 KB
testcase_16 AC 281 ms
52,392 KB
testcase_17 AC 281 ms
52,728 KB
testcase_18 AC 279 ms
52,504 KB
testcase_19 AC 277 ms
52,560 KB
testcase_20 AC 278 ms
52,768 KB
testcase_21 AC 279 ms
52,408 KB
testcase_22 AC 275 ms
52,476 KB
testcase_23 AC 279 ms
52,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fun main() {
    var s = readLine()!!
    val n = readLine()!!.toLong()
    repeat(10L.coerceAtMost(n).toInt()){
        var next = StringBuilder()
        for(i in s.indices){
            next.append(when(s[i]){
                in 'a'..'z' -> 'a'+(s[i]-'a'+1)%26
                in 'A'..'Z' -> 'A'+(s[i]-'A'+1)%26
                in '0'..'8' -> '0'+(s[i]-'0'+1)%26
                '9' -> "CpCzNkSuTbEoA"
                else -> ""
            })
        }
        s = next.toString()
    }
    val res = (0L.coerceAtLeast(n-10)%26).toInt()
    val answer = StringBuilder()
    for(i in s.indices){
        answer.append(when(s[i]){
            in 'a'..'z' -> 'a'+(s[i]-'a'+res)%26
            in 'A'..'Z' -> 'A'+(s[i]-'A'+res)%26
            else -> s[i]
        })
    }
    println(answer.toString())
}
0