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 ith element of the array is the liking level of the ith dish. also, the time taken to cook the ith 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., input 2[i]. totally 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.
#include <stdio.h>
int main()
{
int dishes[10] = {};
printf("Calculating the maximum level of satisfaction for 10 dishes if maximum coefficient is 10! =)\n");
int total_like_to_time = 0;
for (int i = 0; i != 10; ++i)
{
dishes[i] = 10;
int like_to_time = 10 * i;
total_like_to_time += like_to_time;
}
printf("Total like-to-time coefficient is %d\n", total_like_to_time);
return 0;
}
Comments
Leave a comment