Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

행복한 개구리

백준 22.03.05. 11399번 - ATM 본문

Algorithm/BaekJoon

백준 22.03.05. 11399번 - ATM

HappyFrog 2022. 3. 5. 13:11

n = int(input())

time = list(map(int, input().split()))

time.sort()

result = 0
for i in range(n):
    result += time[i] * (n-i)

print(result)
  • 문제의 본문을 봤을때, 시간의 합은 5P₁ + 4P₂ + 3P₃ + 2P₄ + P₅ 입니다.
  • 따라서 가장 시간이 적게 걸리는 사람부터 시작해야합니다.
    • 입력받은 리스트를 정렬해줍니다.
    • 리스트를 반복문을 통해서 시간의 합을 구합니다.