6603 - 로또

LeeKyoungChang·2022년 4월 8일
0

Algorithm

목록 보기
96/203
post-thumbnail

📚 6603 - 로또

로또

 

이해

dfs의 전형적인 문제다!
그런데? 파이썬에서는 순열과 조합 라이브러리가 있다.
시간 복잡도도 라이브러리로 코드 작성할 시 좋은 결과물을 받을 수 있다.

파이썬의 조합 라이브러리 combinations

 

소스

import sys
from itertools import combinations

read = sys.stdin.readline

while True:
    test_case = list(map(int, read().split()))
    if not test_case[0]:
        break

    k = test_case[0]
    s = test_case[1:]

    result = combinations(s, 6)

    for lotto in result:
        print(' '.join(map(str, lotto)))

    print()
profile
"야, (오류 만났어?) 너두 (해결) 할 수 있어"

0개의 댓글