結果

問題 No.1455 拡張ROTN
ユーザー face4face4
提出日時 2021-04-10 23:09:59
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 790 bytes
コンパイル時間 14,530 ms
コンパイル使用メモリ 420,240 KB
実行使用メモリ 52,888 KB
最終ジャッジ日時 2023-09-09 03:11:11
合計ジャッジ時間 23,071 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 269 ms
52,432 KB
testcase_01 WA -
testcase_02 AC 283 ms
52,492 KB
testcase_03 AC 284 ms
52,532 KB
testcase_04 AC 286 ms
52,376 KB
testcase_05 AC 277 ms
52,888 KB
testcase_06 AC 284 ms
52,468 KB
testcase_07 AC 282 ms
52,468 KB
testcase_08 AC 275 ms
52,428 KB
testcase_09 AC 265 ms
52,348 KB
testcase_10 AC 268 ms
52,372 KB
testcase_11 AC 267 ms
52,400 KB
testcase_12 AC 266 ms
52,436 KB
testcase_13 AC 265 ms
52,424 KB
testcase_14 AC 266 ms
52,440 KB
testcase_15 AC 269 ms
52,456 KB
testcase_16 AC 268 ms
52,400 KB
testcase_17 AC 268 ms
52,736 KB
testcase_18 AC 272 ms
52,864 KB
testcase_19 AC 267 ms
52,640 KB
testcase_20 AC 268 ms
52,348 KB
testcase_21 AC 268 ms
52,448 KB
testcase_22 AC 266 ms
52,548 KB
testcase_23 AC 266 ms
52,348 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' -> s[i]+1
                '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 -> ""
        })
    }
    println(answer.toString())
}
0