(SW) List - 암호문3

광어회깍뚝썰기·2021년 8월 18일
0

swea-intermediate

목록 보기
51/51

암호문2에서 명령어 A의 경우를 추가한다.

for tc in range(1,10+1):
    arr_l = int(input())
    arr=list(input().split())
    c_l = int(input())
    c=list(input().split())
    
    for i in range(len(c)):
        if c[i]=='I':
            tmp=c[i+3 : i+3+int(c[i+2])]
            arr[int(c[i+1]):int(c[i+1])]=tmp
        elif c[i]=='D':
            for _ in range(int(c[i+2])):
                arr.pop(int(c[i+1]))
        elif c[i]=='A':
            tmp=c[i+2: i+2+int(c[i+1])]
            arr[-1:-1]=tmp
    
    res=' '.join(arr[0:10])
    print(f'#{tc} {res}')

0개의 댓글

관련 채용 정보