728x90
순열 빠르게 뽑는 방법
from itertools import permutations
p = permutations(range(1,4), 2) #1~3까지 2가지 뽑기
for i in p:
print(" ".join(map(str,i)))
조합 빠르게 뽑는 방법
from itertools import combinations
p = combinations(range(1,4), 2) #1~3까지 2가지 뽑기
for i in p:
print(" ".join(map(str,i)))
728x90
'백준 - python 개념 정리' 카테고리의 다른 글
python(파이썬) set, Counter 개념 이해하기 (0) | 2023.02.22 |
---|---|
python 문법 개인 공부 (0) | 2022.11.17 |
백준 - python 07.26일자 개념 정리 (1) | 2022.07.26 |
백준 - python 07.24일자 개념 정리 (0) | 2022.07.24 |