結果

問題 No.18 うーさー暗号
ユーザー mitsushinomitsushino
提出日時 2017-12-04 17:39:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 45 ms / 5,000 ms
コード長 469 bytes
コンパイル時間 730 ms
コンパイル使用メモリ 10,556 KB
実行使用メモリ 7,872 KB
最終ジャッジ日時 2023-09-21 12:54:29
合計ジャッジ時間 1,296 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,728 KB
testcase_01 AC 14 ms
7,728 KB
testcase_02 AC 15 ms
7,872 KB
testcase_03 AC 45 ms
7,692 KB
testcase_04 AC 19 ms
7,740 KB
testcase_05 AC 19 ms
7,752 KB
testcase_06 AC 30 ms
7,740 KB
testcase_07 AC 34 ms
7,788 KB
testcase_08 AC 43 ms
7,744 KB
testcase_09 AC 32 ms
7,704 KB
testcase_10 AC 17 ms
7,672 KB
testcase_11 AC 14 ms
7,700 KB
testcase_12 AC 23 ms
7,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'


def usa_code(idx, c):
    alphabet_idx = alphabet.index(c)
    while idx > 0:
        alphabet_idx -= 1
        if alphabet_idx < 0:
            alphabet_idx = len(alphabet) - 1
        idx -= 1
    return alphabet[alphabet_idx]


if __name__ == '__main__':
    input_str = input()
    joint_str = ''
    for idx, c in enumerate(input_str, 1):
        joint_str += usa_code(idx, c)
    print(joint_str)
0