https://www.codetree.ai/missions/2/problems/conveyor-belt-triangle/description
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 |