[math] 백준 #6603 로또

zio·2022년 2월 28일
0

Algorithm

목록 보기
10/11

문제

https://www.acmicpc.net/problem/6603

풀이

# 로또
from itertools import combinations

while True:
    l = list(map(int, input().split()))
    if l[0] == 0:
        break

    s = l[1:]
  
    rotto = list(combinations(s,6))
    for r in rotto:
        print(' '.join(map(str, r)))

    print()

접근

combination을 이용해서 조합을 사용하여 풀었다. dfs를 재귀로 해서 풀어도 되는데 나중에 해야지.

profile
🐣

0개의 댓글