새오의 개발 기록

Python : 백준 3003번 본문

Algorithm

Python : 백준 3003번

새오: 2022. 8. 25. 19:09

 

 

3003번: 킹, 퀸, 룩, 비숍, 나이트, 폰

첫째 줄에 동혁이가 찾은 흰색 킹, 퀸, 룩, 비숍, 나이트, 폰의 개수가 주어진다. 이 값은 0보다 크거나 같고 10보다 작거나 같은 정수이다.

www.acmicpc.net

 

(내 코드 풀이)

a, b, c, d, e, f = input().split()
print(int(1)-int(a), int(1)-int(b), int(2)-int(c), int(2)-int(d), int(2)-int(e), int(8)-int(f))

- 굉장히 일차원적인 풀이였다.

 

 


 

 

(1등 코드 풀이)

 

a = [1, 1, 2, 2, 2, 8]
b = list(map(int, input().split()))
for i in range(6):
    print(a[i] - b[i])

 

- 입력 값을 리스트에 바로 넣고 빼버림

'Algorithm' 카테고리의 다른 글

자료구조: 트리  (0) 2022.11.16
Python : 백준 2588번  (0) 2022.08.27
Python : 백준 10926번  (0) 2022.08.25
Python : 백준 10869번  (0) 2022.08.24
Python : 백준 1000번  (0) 2022.08.24