알고리즘
[ greedy ][ 파이썬 ] 백준 11399 번 : ATM
mminky
2022. 2. 23. 17:02
728x90
[ 문제 ]
https://www.acmicpc.net/problem/11399
11399번: ATM
첫째 줄에 사람의 수 N(1 ≤ N ≤ 1,000)이 주어진다. 둘째 줄에는 각 사람이 돈을 인출하는데 걸리는 시간 Pi가 주어진다. (1 ≤ Pi ≤ 1,000)
www.acmicpc.net
[ 코드 ]
n = int(input())
p = list(map(int,input().split()))
p.sort()
total = 0
for i in p:
total += i*n
n -= 1
print(total)
[ 결과 ]
반응형