Equal Candies Codeforces Solution | Codeforces Problem Solution 2022
There are boxes with different quantities of candies in each of them. The -th box has candies inside.
You also have friends that you want to give the candies to, so you decided to give each friend a box of candies. But, you don't want any friends to get upset so you decided to eat some (possibly none) candies from each box so that all boxes have the same quantity of candies in them. Note that you may eat a different number of candies from different boxes and you cannot add candies to any of the boxes.
What's the minimum total number of candies you have to eat to satisfy the requirements?
The first line contains an integer () — the number of test cases.
Most Similar Words Codeforces Solution
The first line of each test case contains an integer () — the number of boxes you have.
The second line of each test case contains integers () — the quantity of candies in each box.
For each test case, print a single integer denoting the minimum number of candies you have to eat to satisfy the requirements.
Join Now for Solution:-
No comments:
Post a Comment