結果

問題 No.1455 拡張ROTN
ユーザー face4
提出日時 2021-04-10 23:09:59
言語 Kotlin
(2.1.0)
結果
WA  
実行時間 -
コード長 790 bytes
コンパイル時間 13,005 ms
コンパイル使用メモリ 438,372 KB
実行使用メモリ 54,496 KB
最終ジャッジ日時 2024-06-26 20:23:08
合計ジャッジ時間 21,376 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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