import sys input = sys.stdin.readline def combination(ind,len_string,combi): if ind == len_string: print(combi) else: for k in range(len_string): if visited[k]: temp = combi+string_list[k] if temp not in record: visited[k] = False record.add(temp) combination(ind+1,len_string,temp) visited[k] = True N = int(input()) for _ in range(N): string_list = list(input().strip()) string_list.sort() len_string = len(string_list) visited = [True]*(len(string_list)) record = set() combination(0,len_string,'')
'알고리즘 > 백준_복기_미완료' 카테고리의 다른 글
[BOJ/백준] 19598 최소 회의실 개수 (0) | 2021.05.07 |
---|---|
[BOJ/백준] 9370 미확인 도착지 (0) | 2021.05.07 |
[BOJ/백준] 19238 스타트 택시 (0) | 2021.05.06 |
[BOJ/백준] 19237 어른 상어 (0) | 2021.05.06 |
[BOJ/백준] 19236 청소년 상어 (0) | 2021.05.06 |