結果
問題 |
No.1455 拡張ROTN
|
ユーザー |
|
提出日時 | 2021-04-10 23:13:28 |
言語 | Kotlin (2.1.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 803 bytes |
コンパイル時間 | 13,269 ms |
コンパイル使用メモリ | 435,748 KB |
実行使用メモリ | 54,484 KB |
最終ジャッジ日時 | 2024-06-26 20:25:49 |
合計ジャッジ時間 | 21,466 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
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 -> "" }) } println(answer.toString()) }