結果

問題 No.18 うーさー暗号
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-09-27 19:29:55
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 293 ms / 5,000 ms
コード長 242 bytes
コンパイル時間 10,639 ms
コンパイル使用メモリ 425,232 KB
実行使用メモリ 58,984 KB
最終ジャッジ日時 2024-04-30 19:15:58
合計ジャッジ時間 13,556 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 265 ms
56,712 KB
testcase_01 AC 267 ms
56,708 KB
testcase_02 AC 258 ms
56,708 KB
testcase_03 AC 288 ms
58,880 KB
testcase_04 AC 282 ms
56,652 KB
testcase_05 AC 275 ms
56,936 KB
testcase_06 AC 281 ms
56,692 KB
testcase_07 AC 283 ms
56,828 KB
testcase_08 AC 277 ms
58,984 KB
testcase_09 AC 289 ms
56,812 KB
testcase_10 AC 268 ms
56,636 KB
testcase_11 AC 279 ms
56,636 KB
testcase_12 AC 293 ms
56,720 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:6:15: warning: '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: '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 #

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