백준 [ALGORITHM] - 카드 놓기 (5568)
              
          2023. 6. 12. 09:33ㆍ코딩/백준 [ALGORITHM]
반응형
    
    
    
  from itertools import permutations
n = int(input())
k = int(input())
lst = []
num = []
for i in range(n):
    x = int(input())
    num.append(x)
permutations = permutations(num, k)
for permutation in permutations:
    number = int(''.join(map(str, permutation)))
    lst.append(number)
print(len(set(lst)))파이썬의 itertools에 조합으로 정수를 만들어주는 함수가 있는 걸 알게 되었다.
근데 시간 생기면 직접 만들어볼 예정
반응형
    
    
    
  '코딩 > 백준 [ALGORITHM]' 카테고리의 다른 글
| 백준 [ALGORITHM] - 빈도 정렬 (2910) (0) | 2024.01.20 | 
|---|---|
| 백준[ALGORITHM] - 팩토리얼 0의 개수 (1676) (0) | 2023.10.31 | 
| 백준 [ALGORITHM] - 명령 프롬프트 (1032) (0) | 2023.06.11 | 
| 백준 [ALGORITHM] - 인사성 밝은 곰곰이 (25192) (0) | 2023.05.29 | 
| 백준 [ALGORITHM] - DFS와 BFS (1260) (0) | 2023.05.28 |