結果

問題 No.18 うーさー暗号
ユーザー kutsutamakutsutama
提出日時 2018-03-24 12:48:19
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 263 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-09-07 08:24:53
合計ジャッジ時間 1,466 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,808 KB
testcase_01 AC 14 ms
7,780 KB
testcase_02 AC 13 ms
7,836 KB
testcase_03 AC 13 ms
7,796 KB
testcase_04 AC 13 ms
7,972 KB
testcase_05 AC 13 ms
7,944 KB
testcase_06 AC 13 ms
7,832 KB
testcase_07 AC 14 ms
7,832 KB
testcase_08 AC 13 ms
7,932 KB
testcase_09 AC 14 ms
7,744 KB
testcase_10 AC 13 ms
7,796 KB
testcase_11 AC 13 ms
7,808 KB
testcase_12 AC 13 ms
7,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()

num = {}
al = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i,c in enumerate(al):
  num[c] = i
res = []
for i,c in enumerate(s):
  m = num[c] - i - 1
  if m >= 0:
    res.append(al[m % len(al)])
  else:
    res.append(al[-(abs(m) % len(al))])
print(''.join(res))
0