[SWEA D3] 1228. [S/W 문제해결 기본] 8일차 - 암호문1

shin·2022년 11월 17일
0

CodingTest 문제 풀이

목록 보기
53/79

문제 : [SWEA D3] 1228. [S/W 문제해결 기본] 8일차 - 암호문1

풀이

for t in range(1, 11):
    N = int(input()) # 원본 암호문 길이
    arr = list(input().split(" ")) # 원본 암호문
    crypto = []
    for i in range(N):
        crypto.append(int(arr[i]))
    n = int(input()) # 명령어 개수
    command = list(input().split(" ")) # 명령어

    i = 0
    index = 0
    num = 0
    for j in range(n):
        index = int(command[i + 1])
        num = int(command[i + 2])
        for k, c in enumerate(command[i + 3 : i + 3 + num]):
            crypto.insert(index + k, int(c))
        i = i + 3 + num

    print(f"#{t}", end = " ")
    for c in crypto[:10]:
        print(c, end = " ")
    print()
profile
Backend development

0개의 댓글