[백준] #2309 일곱 난쟁이 python
2023. 2. 14. 06:00
https://www.acmicpc.net/problem/2309
📕 설명 📕
주어진 수를 list에 넣고 순열 조합을 통해 7개로 쪼개어 합이 100이 되는 경우의 값들을 sort하여 하나씩 출력합니다.
🧑🏻💻 나의 풀이 🧑🏻💻
from itertools import permutations
nanj = []
res = []
for _ in range(9):
nanj.append(int(input()))
N = permutations(nanj,7)
for i in N:
if sum(i) == 100:
for j in sorted(i):
print(j)
break
'Programming > Algorithm' 카테고리의 다른 글
[백준] #2744 대소문자 바꾸기 python (0) | 2023.02.16 |
---|---|
[백준] #2420 사파리월드 python (0) | 2023.02.15 |
[백준] #2386 도비의 영어 공부 python (0) | 2023.02.13 |
[백준] #1864 문어 숫자 python (0) | 2023.02.12 |
[백준] #7510 고급 수학 python (0) | 2023.02.11 |