지나가던 개발자
[Python] 17176번(암호해독기) 문제 풀이 본문
from string import ascii_uppercase, ascii_lowercase
encryption = {" ": 0}
for i in range(1, len(list(ascii_uppercase)+list(ascii_lowercase))+1):
encryption[(list(ascii_uppercase)+list(ascii_lowercase))[i-1]] = i
n = int(input())
numbers = list(map(int, input().split()))
plaintext = []
for i in input():
plaintext.append(encryption[i])
if sorted(numbers) == sorted(plaintext):
print("y")
else:
print("n")
딕셔너리를 직접 52개 노동을 해야 하나 하고 생각했는데 머리를 써서 노동을 면했다.
설마 오늘 빼빼로데이라고 색깔 이렇게 해둔건가... 저번에 할로윈 때도 색깔이 재밌게 변했었는데 말이다.
'PS > Python' 카테고리의 다른 글
[Python] 백준 25206번(너의 평점은) 문제 풀이 (0) | 2022.11.13 |
---|---|
[Python] 백준 5637번(가장 긴 단어) 문제 풀이 (0) | 2022.11.12 |
[Python] 백준 14490번(백대열) 문제 풀이 (0) | 2022.11.10 |
[Python] 백준 5426번(비밀 편지) 문제 풀이 (0) | 2022.11.10 |
[Python] 백준 14584번(암호 해독) 문제 풀이 (0) | 2022.11.09 |
Comments