[백준/Python] 2309번 : 일곱 난쟁이
문제
https://www.acmicpc.net/problem/2309
조합을 활용하는 문제
풀이
파이썬에서 제공하는 itertools의 combinations를 활용하여 손쉽게 풀 수 있는 문제이다.
문제에서 조합의 순서는 상관없다고 했으므로 for loop 내에서 조합들을 순회하며 값의 총합이 100인 경우가 나온다면, 이를 출력하고 루프를 종료했다.
from itertools import combinations as cm
arr = ...
studio-pendant.hashnode.dev1 min read