Computer Science, asked by dasishita842, 12 hours ago

has a little brother called Ahmad. One day Wael came home and saw his brother building towers of and he asked himself the following question: "Won't they be more beautiful if they were of equal heights? n 2 Motivated by this story, Wael made the following problem: Given N towers, such that each tower has height do one of the following operations: m 1 e Put a cube on top of some tower i, the cost of this operation is A. Remove a cube from top of some non-empty tower i, the cost of this operation is B. Move some cube from the top of some non-empty tower i to the top of some another tower), the cost oft 3 What is the minimum cost to make all the towers of equal height? You have to print the final answer (ONLY the fir Note: You cannot create additional towers or ignore some of the pre-existing towers even if their height becomes et Input Format The first line contains an integer, N, denoting the number of elements in H. The next line contains an integer, A, denoting the cost of addition a cube. The next line contains an integer, B. denoting the cost of removing a cube. The next line contains an integer, C, denoting the cost of moving a cube. Each line i of the N subsequent lines (where 0 si< N) contains an integer describing HI.​

Answers

Answered by shashikanthkumar896
0

Answer:

day Wael came home and saw his brother building towers of and he asked himself the following question: "Won't they be more beautiful if they were of equal heights? n 2 Motivated by this story, Wael made the following problem: Given N towers, such that each tower has height do one of the following operations: m 1 e Put a cube on top of some tower i, the cost of this operation is A. Remove a cube from top of some non-empty tower i, the cost of this operation is B. Move some cube from the top of some non-empty tower i to the top of some another tower), the cost oft 3 What is the minimum cost to make all the towers of equal height? You have to print the final answer (ONLY the fir Note: You cannot create additional towers or ignore some of the pre-existing towers even if their height becomes et Input Format The first line contains an integer, N, denoting the number of elements in H. The next line contains an integer, A, denoting the cost of addition a cube. The next line contains an integer, B. denoting the cost of removing a cube. The next line contains an integer, C, denoting the cost of moving a cube. Each line i of the N subsequent lines (where 0 si< N) contains an integer describing HI

Similar questions