結果

問題 No.18 うーさー暗号
ユーザー 0918nobita0918nobita
提出日時 2016-04-04 22:52:23
言語 Ruby
(3.3.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 255 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 11,100 KB
実行使用メモリ 15,308 KB
最終ジャッジ日時 2023-09-21 12:11:09
合計ジャッジ時間 1,855 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
15,164 KB
testcase_01 AC 76 ms
14,972 KB
testcase_02 AC 75 ms
15,080 KB
testcase_03 AC 77 ms
15,308 KB
testcase_04 AC 76 ms
14,976 KB
testcase_05 AC 75 ms
15,152 KB
testcase_06 AC 76 ms
15,304 KB
testcase_07 AC 77 ms
15,088 KB
testcase_08 AC 77 ms
15,156 KB
testcase_09 AC 77 ms
15,088 KB
testcase_10 AC 75 ms
15,204 KB
testcase_11 AC 74 ms
15,304 KB
testcase_12 AC 75 ms
15,092 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

input = gets
output = ""
alphabet = ('A'.ord..'Z'.ord).to_a.map(&:to_i).map(&:chr)
gap = 1
input.split(//).each_with_index{|val, index|
  if index < input.length - 1 then
    output << alphabet[(val.ord - 65 - gap) % 26].to_s
  end
  gap+=1
}
puts output
0