본문 바로가기
Algorithm

[구현/수학] 백준 13240 Chessboard - 파이썬(Python)

by jangThang 2023. 1. 3.
반응형

백준 온라인 저지

 

[ Contents ]

     

     

    1. 문제 (링크 참조)

     

    13240번: Chessboard

    A single line with two integers N and M separated by spaces. The number N will represent the number of rows and M the number of columns. N and M will be between 1 and 10.

    www.acmicpc.net

     

     

     

    2. 문제 풀이

     N * M 크기의 체스판을 출력하는 문제입니다.

     

     

     

    3. 코드

    # 입력
    N, M = map(int, input().split())
    
    # 출력
    for i in range(N):
        for j in range(M):
            if (i+j) % 2 == 0:
                print('*', end='')
            else:
                print('.', end='')
        print()

     

     

    star가 되고나서 Tistory

    반응형

    댓글