結果

問題 No.18 うーさー暗号
ユーザー momoyuumomoyuu
提出日時 2022-03-22 03:26:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 512 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,864 KB
最終ジャッジ日時 2024-04-18 00:31:11
合計ジャッジ時間 1,313 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,840 KB
testcase_01 AC 39 ms
52,096 KB
testcase_02 AC 39 ms
52,352 KB
testcase_03 AC 40 ms
52,864 KB
testcase_04 AC 39 ms
52,480 KB
testcase_05 AC 38 ms
52,224 KB
testcase_06 AC 40 ms
52,480 KB
testcase_07 AC 38 ms
52,224 KB
testcase_08 AC 39 ms
52,736 KB
testcase_09 AC 40 ms
52,352 KB
testcase_10 AC 42 ms
52,096 KB
testcase_11 AC 40 ms
51,712 KB
testcase_12 AC 39 ms
51,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.readline
    S = input()
    chars = {
    "A":1,"B":2,"C":3,"D":4,"E":5,
    "F":6,"G":7,"H":8,"I":9,"J":10,
    "K":11,"L":12,"M":13,"N":14,"O":15,
    "P":16,"Q":17,"R":18,"S":19,"T":20,
    "U":21,"V":22,"W":23,"X":24,"Y":25,
    "Z":26}
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    s = ""
    for i in range(len(S)-1):
        a = S[i]
        n = chars[a] - (i + 1)
        n %= 26
        s += alpha[n-1]
    print(s)
if __name__ == '__main__':
    main()
0