Notice
Recent Posts
Recent Comments
Link
대왕휴지의 개발 공부
[백준 11399] ATM (파이썬, 문제 풀이 없음) 본문
그리디 알고리즘
def TimeCalculation(_people):
peCount = len(_people)
peopleList = list()
minTime = 10000
minTime_pIndex = 0
forCount = peCount
for i in range(0, peCount):
minTime = 10000
for j in range(0,forCount):
if minTime > _people[j]:
minTime = _people[j]
minTime_pIndex = j
peopleList.append(_people[minTime_pIndex])
del _people[minTime_pIndex]
forCount -= 1
#-----------------------------------
totalTime = 0
time = 0
listCount = 1
for i in range(0, peCount):
time = 0
_count = listCount
for j in range(0, _count) :
time += peopleList[j]
totalTime+= time
listCount += 1
return totalTime
sequence = int(input())
people = list()
people = list(map(int, input().split()))
totalTime = TimeCalculation(people)
print(totalTime)
'프로그래밍 > 백준 문제' 카테고리의 다른 글
[백준 2720] 세탁소 사장(파이썬, 문제 풀이 없음) (0) | 2023.06.06 |
---|---|
[백준 25501번] 재귀의 귀재 (C언어 and 파이썬) : 문제 풀이 없음 (0) | 2023.01.30 |
[백준 10870번] 피보나치 수 5 (C언어 and 파이썬) : 문제 풀이 없음 (0) | 2023.01.29 |
[백준 10872번] 팩토리얼 (C언어 and 파이썬) : 시간 초과 오류 (0) | 2023.01.29 |
[백준 2445번] 별찍기 - 8 (C언어 and 파이썬) : 문제풀이 없음 (0) | 2023.01.29 |