結果
| 問題 | No.18 うーさー暗号 | 
| コンテスト | |
| ユーザー |  harhogefoo | 
| 提出日時 | 2016-10-05 08:22:59 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 77 ms / 5,000 ms | 
| コード長 | 321 bytes | 
| コンパイル時間 | 123 ms | 
| コンパイル使用メモリ | 7,552 KB | 
| 実行使用メモリ | 12,544 KB | 
| 最終ジャッジ日時 | 2024-07-07 06:18:50 | 
| 合計ジャッジ時間 | 1,610 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 13 | 
コンパイルメッセージ
Syntax OK
ソースコード
def convert_alphabet(byte, shift_count)
  shift_count = shift_count % 26
  if byte - shift_count < 65
    byte = byte - shift_count + 26
  else
    byte = byte - shift_count
  end
  "" << byte
end
cipher = gets.chomp
j = 1
answer = ""
cipher.each_byte do |b|
  answer += convert_alphabet(b, j)
  j += 1
end
puts answer
            
            
            
        