結果

問題 No.1455 拡張ROTN
ユーザー face4face4
提出日時 2021-04-10 23:13:28
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 803 bytes
コンパイル時間 14,863 ms
コンパイル使用メモリ 425,744 KB
実行使用メモリ 54,296 KB
最終ジャッジ日時 2023-09-09 03:14:19
合計ジャッジ時間 23,339 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 270 ms
52,664 KB
testcase_01 WA -
testcase_02 AC 297 ms
52,520 KB
testcase_03 AC 284 ms
52,540 KB
testcase_04 AC 283 ms
52,468 KB
testcase_05 AC 277 ms
52,500 KB
testcase_06 AC 281 ms
52,752 KB
testcase_07 AC 288 ms
52,432 KB
testcase_08 AC 279 ms
52,388 KB
testcase_09 AC 274 ms
54,296 KB
testcase_10 AC 271 ms
52,320 KB
testcase_11 AC 270 ms
52,332 KB
testcase_12 AC 270 ms
52,448 KB
testcase_13 AC 269 ms
52,452 KB
testcase_14 AC 278 ms
52,456 KB
testcase_15 AC 273 ms
52,824 KB
testcase_16 AC 271 ms
52,772 KB
testcase_17 AC 268 ms
52,432 KB
testcase_18 AC 267 ms
52,372 KB
testcase_19 AC 268 ms
52,324 KB
testcase_20 AC 271 ms
52,360 KB
testcase_21 AC 271 ms
52,304 KB
testcase_22 AC 266 ms
52,272 KB
testcase_23 AC 270 ms
52,344 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 -> ""
        })
    }
    println(answer.toString())
}
0