結果
問題 |
No.1455 拡張ROTN
|
ユーザー |
|
提出日時 | 2021-04-10 23:14:53 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 306 ms / 2,000 ms |
コード長 | 805 bytes |
コンパイル時間 | 11,589 ms |
コンパイル使用メモリ | 435,368 KB |
実行使用メモリ | 54,536 KB |
最終ジャッジ日時 | 2024-06-26 20:26:31 |
合計ジャッジ時間 | 19,651 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
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()) }