結果

問題 No.18 うーさー暗号
コンテスト
ユーザー toshiro_yanagi
提出日時 2018-09-27 19:29:55
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 206 ms / 5,000 ms
コード長 242 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,588 ms
コンパイル使用メモリ 459,096 KB
実行使用メモリ 54,764 KB
最終ジャッジ日時 2026-05-14 19:53:28
合計ジャッジ時間 12,055 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:6:15: warning: 'fun toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
		val a = 'A'.toInt()
              ^^^^^
Main.kt:8:15: warning: 'fun toInt(): Int' is deprecated. Conversion of Char to Number is deprecated. Use Char.code property instead.
		val t = ((c.toInt() - i - 1) % b + a) % b + a
              ^^^^^

ソースコード

diff #
raw source code

fun main(args: Array<String>) {
	val S = readLine()!!
	var ans = ""

	S.forEachIndexed { i, c ->
		val a = 'A'.toInt()
		val b = ('A' .. 'Z').toList().size
		val t = ((c.toInt() - i - 1) % b + a) % b + a
		ans += t.toChar()
	}
	println(ans)
}
0