[HackerRank][Python3] Greedy Florist
2018. 7. 16. 00:44 |
프로그래밍/HackerRank
Problem :
https://www.hackerrank.com/challenges/greedy-florist/problem
My Solution :
#!/usr/bin/python3
def getMinimumCost(k, c):
cost = 0
c.sort(reverse=True)
for i in range(len(c)):
cost += ((i // k) + 1) * c[i]
return cost
n, k = map(int, input().split())
c = list(map(int, input().rstrip().split()))
minimumCost = getMinimumCost(k, c)
print(minimumCost)
'프로그래밍 > HackerRank' 카테고리의 다른 글
| [HackerRank][Python3] Pairs (0) | 2018.07.17 |
|---|---|
| [HackerRank][Python3] Hash Tables: Ice Cream Parlor (0) | 2018.07.16 |
| [HackerRank][Python3] Triple sum (0) | 2018.07.16 |
| [HackerRank][Python3] Max Min (0) | 2018.07.16 |
| [HackerRank][Python3] Luck Balance (0) | 2018.07.15 |
| [HackerRank][Python3] Common Child (0) | 2018.07.15 |
| [HackerRank][Python3] Sherlock and the Valid String (0) | 2018.07.15 |
| [HackerRank][Python3] Strings: Making Anagrams (0) | 2018.07.15 |
최근에 달린 댓글 최근에 달린 댓글