15650

    백준 15650 풀이 (재귀함수)

    저번에 풀었던 15649문제에서 코드를 살짝만 수정하면 쉽게 구할수 있다. 조건은 뒤에 수열이 반드시 오름차순이어야하며 중복을 포함하지 않는다. 코드의 중복이 살짝 있지만 애교로 넘어가자 n,m = map(int,input().split()) Map=[i for i in range(1,n+1)] def back(tlist, n,m): if m == 0: for i in tlist: print(Map[i],end=' ') print() return for i in range(n): if len(tlist) == 0: tlist.append(i) back(tlist,n,m-1) tlist.pop() else: if i > tlist[-1]: tlist.append(i) back(tlist,n,m-1) tli..