순열

    [python] 백준 - 10819. 차이를 최대로

    [python] 백준 - 10819. 차이를 최대로

    🤔문제 해결 S2 | 완전탐색, 백트래킹 백트래킹을 하려고 했으나, 순열로 푸는게 더 간단해보여서 조합을 이용했다. 숫자들을 배치할 수 있는 모든 경우의 수를 뽑아서 규칙에 맞게 계산을 해주고 최대값을 찾는다. 💻소스 코드 from itertools import permutations def my_sum(numbers_tuple): # 문제의 규칙에 맞게 더하기 total = 0 for i in range(N - 1): total += abs(numbers_tuple[i] - numbers_tuple[i + 1]) return total if __name__ == '__main__': N = int(input()) numbers = list(map(int, input().split())) answer =..