https://www.acmicpc.net/problem/12778
12778번: CTP공국으로 이민 가자
신생국가 CTP공국은 자신들만의 글자가 없다. CTP공국의 왕 준형이는 전 세계 표준 언어인 알파벳을 사용하기로 했다. 하지만 숫자에 미친 사람들이 모인 CTP공국 주민들은 알파벳을 사용할 때 평
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
def sol(type_prob, probs):
if type_prob == 'C':
answer = [ord(i)-64 for i in probs]
elif type_prob == 'N':
answer = [chr(int(i) + 64) for i in probs]
return answer
if __name__ == '__main__':
t = int(input())
for _ in range(t):
m, type_prob = input().split()
probs = list(input().split())
print(*sol(type_prob, probs))
|
cs |
'A' 의 아스키코드 값은 65라는 사실
Ascii code of A is 65
반응형
'python-algorithm' 카테고리의 다른 글
백준 3765 Celebrity jeopardy (0) | 2022.11.30 |
---|---|
백준 14954 Happy Number (0) | 2022.11.30 |
백준 11104 Fridge of Your Dreams (0) | 2022.11.30 |
백준 26082 WARBOY (0) | 2022.11.30 |
백준 25828 Corona Virus Testing (0) | 2022.11.30 |
댓글