자르비 왕국
[백준] 2309 일곱 난쟁이 - Python 본문
https://www.acmicpc.net/problem/2309
2309번: 일곱 난쟁이
아홉 개의 줄에 걸쳐 난쟁이들의 키가 주어진다. 주어지는 키는 100을 넘지 않는 자연수이며, 아홉 난쟁이의 키는 모두 다르며, 가능한 정답이 여러 가지인 경우에는 아무거나 출력한다.
www.acmicpc.net
from itertools import combinations
littles = []
for _ in range(9) :
littles.append(int(input()))
littles = list(map(list, combinations(littles, 7)))
for comb in littles :
comb.sort()
if(sum(comb) == 100) :
for height in comb :
print(height)
break
'문제풀이' 카테고리의 다른 글
[백준] 2693 N번째 큰 수 - Python (0) | 2022.01.18 |
---|---|
[백준] 2609 최대공약수와 최소공배수 - Python (0) | 2022.01.18 |
[백준] 2460 지능형 기차2 - Python (0) | 2022.01.18 |
[백준] 3460 이진수 - Python (0) | 2022.01.18 |
[백준] 2501 약수구하기 - Python (0) | 2022.01.18 |