목록10972 (1)
황소개발자
백준 10972 파이썬 python : 다음 순열 @@황소처럼 우직하게@@ 가자 이 개쉐이야~
import sys input = sys.stdin.readline n = int(input()) lst = list(map(int, input().split())) def next_permutation(lst): if len(lst) == 1: return [-1] for i in range(len(lst) - 1, 0, -1): if lst[i] > lst[i - 1]: break if i == 1 and lst[0] > lst[1]: return [-1] # i - 1 인덱스하고 i ~ len(lst) - 1 인덱스에서 # i-1 인덱스값보다 크면서 제일 작은거랑 바꿔야함 # 끝에는 내림차순이기에 끝에서부터 비교 ㄱㄱ for j in range(len(lst) - 1, -1, -1): if lst[..
백준 문제 풀이
2020. 2. 28. 05:29