-
[6616] 문자열 암호화 (Python)[Python] 알고리즘/Silver 2021. 11. 29. 11:55
[문제]
https://www.acmicpc.net/problem/6616
알고리즘 분류는 구현, 문자열 입니다.
2
ABCDEFGH
결과 : AEBFCGDH
[코드]
import sys while True: N = int(sys.stdin.readline()) if N == 0: break text = "".join(sys.stdin.readline().rstrip().split()).upper() dt = dict() i = 0 m = 0 cnt = 0 while True: if len(dt) == len(text): break if i >= len(text): cnt += 1 i = cnt dt[i] = text[m] i += N m += 1 dt = sorted(dt.items(), key=lambda x: x[0]) for i in dt: print(i[1], end="") print()
'[Python] 알고리즘 > Silver' 카테고리의 다른 글
[4900] 7 더하기 (Python) (0) 2021.12.01 [21919] 소수 최소 공배수 (Python) (0) 2021.11.30 [1706] 크로스워드 (Python) (0) 2021.11.25 [14495] 피보나치 비스무리한 수열 (Python) (0) 2021.11.23 [11508] 2+1 세일 (Python) (0) 2021.11.22