[SWEA] 숫자 배열 회전

Date:

[SWEA] 숫자 배열 회전

Problem URL : 숫자 배열 회전

TC = int(input())

for tc in range(1, TC + 1):
    N = int(input())
    arr = []
    for i in range(N):
        arr.append(input().split())

    arr2 = [[0] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            arr2[j][N - 1 - i] = arr[i][j]

    arr3 = [[0] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            arr3[j][N - 1 - i] = arr2[i][j]

    arr4 = [[0] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            arr4[j][N - 1 - i] = arr3[i][j]

    print("#{}".format(tc))
    for i in range(N):
        print(''.join(arr2[i]), end=' ')
        print(''.join(arr3[i]), end=' ')
        print(''.join(arr4[i]), end=' ')
        print()

댓글