-
[백준] 15652번_N과M(4)Study/알고리즘 2020. 1. 29. 14:24
문제 링크 : https://www.acmicpc.net/problem/15652
15652번: N과 M (4)
한 줄에 하나씩 문제의 조건을 만족하는 수열을 출력한다. 중복되는 수열을 여러 번 출력하면 안되며, 각 수열은 공백으로 구분해서 출력해야 한다. 수열은 사전 순으로 증가하는 순서로 출력해야 한다.
www.acmicpc.net
from itertools import combinations_with_replacement n,m = map(int,input().split()) comb = combinations_with_replacement(range(1,n+1),m) for c in comb: print(' '.join(map(str,c)))
중복조합 : combinations_with_replacement
'Study > 알고리즘' 카테고리의 다른 글
[백준] 1526번_가장큰금민수 (0) 2020.01.30 [백준] 15686번_치킨배달 (0) 2020.01.29 [백준] 15651번_N과M(3) (0) 2020.01.29 [백준] 15650번_N과M(2) (0) 2020.01.29 [백준] 15649번_N과M(1) (0) 2020.01.29