結果

問題 No.18 うーさー暗号
ユーザー takuuuuumi34
提出日時 2016-06-10 22:33:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 874 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-07-07 06:10:23
合計ジャッジ時間 959 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

int_from_c = {
        'A': 0,
        'B': 1,
        'C': 2,
        'D': 3,
        'E': 4,
        'F': 5,
        'G': 6,
        'H': 7,
        'I': 8,
        'J': 9,
        'K': 10,
        'L': 11,
        'M': 12,
        'N': 13,
        'O': 14,
        'P': 15,
        'Q': 16,
        'R': 17,
        'S': 18,
        'T': 19,
        'U': 20,
        'V': 21,
        'W': 22,
        'X': 23,
        'Y': 24,
        'Z': 25
       }

alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];

def decode(i, c):
  j = int_from_c[c]
  return alphabet[j - i]

def main():
  str = input()
  decoded = ""
  j = 1

  for s in str:
    decoded = decoded + decode(j, s)
    if(j > 25):
      j = 1
    else:
      j += 1

  print(decoded)

if __name__ == '__main__':
  main()
0