Holiday Of Equality

Problem Link :

This problem asks you how many burles (currency in the story) would it take so that the citizens will have same amount of money.
It is stated in the problem we can’t take money from citizens, so the only way is to increment each citizen’s money until they have the same amount ( we are not supposed to increment a citizen’s money that has the highest value among all)

It’s possible to skip using arrays to store number of money each citizen has, by simply summing the number of money each citizen has and find out how much money the richest citizen has.
Doing so will allow us to count how much money would all citizen have in total, and then we simply substract it with amount of money all citizens have at first.

Leave a Reply

Your email address will not be published. Required fields are marked *