結果
| 問題 | No.18 うーさー暗号 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-09-08 04:37:01 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 80 ms / 5,000 ms | 
| コード長 | 572 bytes | 
| コンパイル時間 | 38 ms | 
| コンパイル使用メモリ | 7,680 KB | 
| 実行使用メモリ | 12,288 KB | 
| 最終ジャッジ日時 | 2024-07-07 06:36:20 | 
| 合計ジャッジ時間 | 1,586 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 13 | 
コンパイルメッセージ
Syntax OK
ソースコード
class WowCode
    attr_reader :s
    def initialize(s: "")
        @s = s
        @alphabet = ('A'..'Z').to_a
    end
    def cause
        begin
            @s = gets.chomp
        rescue
            
        end
    end
    def decoding(str)
        str = str.split("")
        r = str.each_with_index.map do |c, i|
            @alphabet[((c.ord-(i+1))-("A".ord)) % @alphabet.size]
        end
        r.join("")
    end
    def result
        puts decoding(@s)
    end
    def run
        cause
        result
    end
end
if $0 == __FILE__
    WowCode.new.run
end
            
            
            
        