[SW Expert Academy, SWEA 15612] 체스판 위의 룩 배치 (python)
Problem Solving/SWEA

[SW Expert Academy, SWEA 15612] 체스판 위의 룩 배치 (python)

728x90

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AYOBfxwaAXsDFATW&categoryId=AYOBfxwaAXsDFATW&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=3&pageSize=10&pageIndex=1

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com


※ SW Expert 아카데미의 문제를 무단 복제하는 것을 금지합니다.

728x90

t = int(input())

for test_case in range(1, t + 1):
    chessboard = [list(input()) for _ in range(8)]
    rotated_chessboard = list(zip(*chessboard[::-1]))
    result = True

    for i in range(8):
        # 가로줄에도 'O'가 하나여야 하고
        if chessboard[i].count('O') != 1:
            result = False
            break
        # 세로줄에도 'O'가 하나여야 한다
        if rotated_chessboard[i].count('O') != 1:
            result = False
            break

    if result:
        print("#{} yes".format(test_case))
    else:
        print("#{} no".format(test_case))
728x90