Question : Reducing Dishes Monica has cooked N dishes and collected the data on the level of satisfaction for all the dishes from a guest. The guest returns an array, where the thelement of the array is the liking level of the ith dish. Also, the time taken to cook the th dish is i. Like-to-time coefficient of a dish is calculated by multiplying the time taken to cook food with its liking level, i.e., i'input2]). Total Like-to-time coefficient is calculated by summing up all individual coefficients of dishes. You want the total Like-to-time coefficient to be maximum. You can also remove some dishes, in which case, a new coefficient is calculated using the left dishes. Find the maximum sum of all possible Like-to-time coefficients. Input Specification: input1: N, number of dishes input2: Array representing the liking value of each dish
Answers
Explanation:
Suppose there is a chef. And he has collected data on the satisfaction level of his n dishes. The Chef can cook any dish in 1 unit of time. Like-time coefficient of a dish is actually the time taken
Suppose there is a chef. And he has collected data on the satisfaction level of his n dishes. The Chef can cook any dish in 1 unit of time. Like-time coefficient of a dish is actually the time takento cook that dish including previous dishes multiplied by its satisfaction level So time[i]*satisfaction[i].
Suppose there is a chef. And he has collected data on the satisfaction level of his n dishes. The Chef can cook any dish in 1 unit of time. Like-time coefficient of a dish is actually the time takento cook that dish including previous dishes multiplied by its satisfaction level So time[i]*satisfaction[i].We have to find the maximum sum of Like-time coefficient that the chef can obtain after dishes preparation. Dishes can be ready in any order and the chef can discard some dishes to get this maximum value.