結果

問題 No.18 うーさー暗号
ユーザー hal9009hal9009
提出日時 2020-11-01 16:23:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 277 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 7,948 KB
最終ジャッジ日時 2023-09-29 11:18:19
合計ジャッジ時間 1,328 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,792 KB
testcase_01 AC 15 ms
7,796 KB
testcase_02 AC 15 ms
7,844 KB
testcase_03 AC 15 ms
7,836 KB
testcase_04 AC 14 ms
7,800 KB
testcase_05 AC 14 ms
7,844 KB
testcase_06 AC 14 ms
7,784 KB
testcase_07 AC 14 ms
7,832 KB
testcase_08 AC 14 ms
7,824 KB
testcase_09 AC 14 ms
7,884 KB
testcase_10 AC 14 ms
7,948 KB
testcase_11 AC 14 ms
7,888 KB
testcase_12 AC 14 ms
7,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def to_ord(s: str):
    return ord(s) - 65


def to_chr(c):
    return chr(c+65)


S = input()
len_S = len(S)

code = list(map(to_ord, S))
shift = list(range(1, len(S) + 1))
ans_code = [(i - j) % 26 for i, j in zip(code, shift)]

ans = ''.join(map(to_chr, ans_code))
print(ans)
0