순열 : 서로 다른 n개의 원소 중 순서를 고려하여 r개의 배열로 나열
순열 공식 : nPr = n!/(n-r)!
from itertools import permutations
a = [10, 20, 30]
permute = permutations(a,2)
print(list(permute))
# result : [(10, 20), (10, 30), (20, 10), (20, 30), (30, 10), (30, 20)]
조합 : 서로 다른 n개의 원소 중 순서를 고려하지 않고 r개의 배열로 나열
조합 공식 : nCr = n!/r!(n-r)!
from itertools import combinations
a = [1, 2, 3, 4]
comb = combinations(a, 2)
print(list(comb))
# result : [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
from itertools import combinations
def nanjang_hieght(nanjang):
combi = combinations(nanjang,7)
combi = list(combi) # 모든 combination 결과
for i in range(len(combi)):
if sum(combi[i]) == 100:
return sorted(combi[i])
if __name__ == '__main__':
height_list = []
for i in range(9):
height_list.append(int(input()))
height_list = nanjang_hieght(height_list)
for i in range(len(height_list)):
print(height_list[i])