반응형
6603번: 로또
입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 테스트 케이스는 한 줄로 이루어져 있다. 첫 번째 수는 k (6 < k < 13)이고, 다음 k개 수는 집합 S에 포함되는 수이다. S의 원소는 오름차순으로
www.acmicpc.net
# @Author YoungMinKim
# baekjoon
import itertools
import sys
while True:
a = list(map(int,sys.stdin.readline().split()))
if a == [0]:
break
event = list(itertools.combinations(a[1:], 6))
for i in event:
for j in i:
print(j,end=' ')
print()
print()
itertools 라는 라이브러리를 통해 경우의 수를 계산할 수 있다.
문제에선 Combination 경우의 수를 뽑는 것이므로 combinations 함수를 사용하였다.
반응형
'백준 문제풀이' 카테고리의 다른 글
| baekjoon - python - 1735 (0) | 2020.11.24 |
|---|---|
| baekjoon - python - 9093 (0) | 2020.11.22 |
| baekjoon - python - 10101 (0) | 2020.10.28 |
| baekjoon - python - 7567 (0) | 2020.10.28 |
| baekjoon - python - 15740 (0) | 2020.10.25 |
댓글