https://www.codetree.ai/missions/2/problems/conveyor-belt-triangle/description
코드트리 | 코딩테스트 준비를 위한 알고리즘 정석
국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.
www.codetree.ai
import sys
from collections import deque
input = sys.stdin.readline
n, time = map(int, input().split(" "))
graph = []
for _ in range(3):
temp = list(map(int, input().rstrip().split(" ")))
graph.append(temp)
for t in range(time):
temp = deque([x[-1] for x in graph])
temp.appendleft(temp.pop())
for i in range(3):
for j in range(n-1, 0, -1):
graph[i][j] = graph[i][j-1]
for i in range(3):
graph[i][0] = temp[i]
for row in graph:
print(*row)728x90
반응형
'🔻PS > Codetree' 카테고리의 다른 글
| [Codetree] 방향에 맞춰 이동 Python (0) | 2024.07.29 |
|---|---|
| [Codetree] 1차원 젠가 Python (0) | 2024.07.28 |
| [Codetree] 컨베이어 벨트 Python (0) | 2024.07.27 |
| [Codetree] 행복한 수열의 개수 Python (1) | 2024.07.23 |
| [Codetree] 최고의 33위치 Python (1) | 2024.07.23 |