Algorithm
[BaekJoon] 백준 알고리즘 6603번 / 로또 / 백트래킹(DFS) / Python
bkuk
2023. 3. 10. 12:04
def dfs( depth, idx ):
if len(q) == 6:
print( " ".join(map(str,q)))
return
for i in range( idx, k ):
q.append(S[i])
dfs(depth + 1, i + 1)
q.pop()
while True:
global S
array = list(map(int, input().split()))
k = array[0]
S = array[1:]
q = []
dfs( 0, 0 )
if k == 0:
exit()
print()