結果

問題 No.18 うーさー暗号
ユーザー harhogefooharhogefoo
提出日時 2016-10-05 08:22:59
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 321 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 11,532 KB
実行使用メモリ 15,524 KB
最終ジャッジ日時 2023-09-21 12:29:06
合計ジャッジ時間 2,135 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,228 KB
testcase_01 AC 77 ms
15,208 KB
testcase_02 AC 77 ms
15,108 KB
testcase_03 AC 83 ms
15,264 KB
testcase_04 AC 77 ms
15,296 KB
testcase_05 AC 77 ms
15,120 KB
testcase_06 AC 76 ms
15,416 KB
testcase_07 AC 79 ms
15,268 KB
testcase_08 AC 77 ms
15,524 KB
testcase_09 AC 78 ms
15,268 KB
testcase_10 AC 76 ms
15,160 KB
testcase_11 AC 77 ms
15,012 KB
testcase_12 AC 79 ms
15,320 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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
0