sm 기술 블로그

173. 3003(킹, 퀸, 룩, 비숍, 나이트, 폰) - 파이썬 본문

문제/백준_파이썬

173. 3003(킹, 퀸, 룩, 비숍, 나이트, 폰) - 파이썬

sm_hope 2022. 8. 13. 12:26
import sys
input = sys.stdin.readline

N = list(map(int, input().split()))
chessPiece = [1, 1, 2, 2, 2, 8]
result = []

for i in range(len(N)):
    result.append(str(chessPiece[i]-N[i]))

print(" ".join(result))

문제요약

킹 1 퀸 1 룩 2 비숍 2 나이트 2 폰 8이 되도록 만들어라

설명

체스판에 필요한 말들의 각각의 개수를 리스트로 저장하였다.

chessPiece = [1, 1, 2, 2, 2, 8]

말들의 값에서 입력된 값을 빼준다면 필요한 말의 개수를 알 수 있다.

for i in range(len(N)):
    result.append(str(chessPiece[i]-N[i]))
Comments