結果

問題 No.18 うーさー暗号
コンテスト
ユーザー KoheC
提出日時 2020-07-06 16:38:44
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 305 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 191 ms
コンパイル使用メモリ 8,960 KB
実行使用メモリ 14,720 KB
最終ジャッジ日時 2026-04-11 20:29:12
合計ジャッジ時間 1,535 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

input_array = gets.chomp.chars
count = 1

for input in input_array
    if count > 26
        count = 1
    end
    input = input.ord - count
    
    if input < 65
        input = 26 + input
    elsif input > 90
        input = 156 - input
    end
    input = input.chr
    print input
    count += 1
end
0