반응형
문제
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
🐍파이썬
T = 10
for test_case in range(1, T + 1):
ans = 0
input() #원본 암호문 길이
code = list(input().split()) #원본 암호문
input() #명령어의 개수
command = list(input().split()) #명령어
for i in range(len(command)):
if command[i] == "I":
x, y = int(command[i+1]), int(command[i+2])
for j in range(y): #y개 insert
s = command[i+3+j] #3번째 숫자부터 차례로
code.insert(x+j, s) #x번째 수 뒤에 insert
elif command[i] == "D":
x, y = int(command[i+1]), int(command[i+2])
code = code[:x]+code[x+y:]
elif command[i] == "A":
y = int(command[i+1])
for j in range(y):
code.append(command[i+2+j])
print("#{} {}".format(test_case, ' '.join(code[:10])))
반응형
'Problem Solving > SWEA' 카테고리의 다른 글
[SWEA|파이썬] 1954. 달팽이 숫자 (D2) (1) | 2023.05.20 |
---|---|
[SWEA|파이썬] 3499. 퍼펙트 셔플 (D3) (0) | 2023.05.20 |
[SWEA|파이썬] 5356. 의석이의 세로로 말해요 (D3) (0) | 2023.05.20 |
[SWEA|파이썬] 1873. 상호의 배틀필드 (D3) (1) | 2023.05.19 |
[SWEA|파이썬] 13428. 숫자 조작 (D3) (0) | 2023.05.18 |
[SWEA|파이썬] 3131. 100만 이하의 모든 소수 (D3)-에라토스테네스의 체 (1) | 2023.05.16 |