1961-回転数配列複写


問題の説明
リンク
問題を解く
lotaion前後i,jに関するルールを探します.
各LOTAION 90度はafter[i][j] = before[j][len(after) - i - 1]の規則性を有する.
  • 上記のタスクを完了するlotaion関数を作成します.
  • first,second,thirdはそれぞれ90180,270度回転した結果配列を入れる.
  • zip内蔵関数印刷出力.
  • コード#コード#
    T = int(input())
    for tc in range(1, T+1):
        N = int(input())
        arr = [list(input().split()) for _ in range(N)]
        firstLotation = [[0] * N for _ in range(N)]
        secondLotation = [[0] * N for _ in range(N)]
        thirdLotation = [[0] * N for _ in range(N)]
    
        firstLotation = lotation(arr, N)
        secondLotation = lotation(firstLotation, N)
        thirdLotation = lotation(secondLotation, N)
    
        print(f'#{tc}')
        for first, second, third in zip(firstLotation, secondLotation, thirdLotation):
            print(f'{"".join(map(str, first))} {"".join(map(str, second))} {"".join(map(str,third))}')