A chef has collected data on the
satisfaction
level of hisn
dishes. Chef can cook any dish in 1 unit of time.
Like-time coefficient of a dish is defined as the time taken to cook that dish including previous dishes multiplied by its satisfaction level i.e.time[i] * satisfaction[i]
.
Return the maximum sum of like-time coefficient that the chef can obtain after dishes preparation.
Dishes can be prepared in any order and the chef can discard some dishes to get this maximum value.
Constraints:
n == satisfaction.length
1 <= n <= 500
-1000 <= satisfaction[i] <= 1000
一個廚師收集了他
n
盤菜餚的satisfaction
(滿意度)等級數據。廚師可以在一個單位時間內完成一道任意的菜餚。
一道菜餚的喜歡時間係數定義為烹煮這道菜餚(包含之前所有菜餚)花費的時間乘上菜餚的滿意度。也就是time[i] * satisfaction[i]
(時間[i] * 滿意度[i])。
回傳廚師準備菜肴後可獲得的最大喜歡時間係數之和。
菜餚可以按照任意順序做準備,廚師也可以捨棄任意數量的菜餚以獲得最大值。
限制:
n == satisfaction.length
1 <= n <= 500
-1000 <= satisfaction[i] <= 1000
LeetCode
C++