The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 5 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Uncle Ben is a very kind man and is revered by the whole neighborhood. One halloween night a group of trick-or-treaters come by Ben's house. Uncle Ben has some treats with him but he sees that the children do not have equal number of treats. He feels that it would be unfair to give away the treats to just any of the kids. So he decides to line up all the kids and distribute the treats according to the number of treats that the respective child has, so that he may equalize the number of treats to the best extent. What is the maximum number of children that have equal number of treats. It is not necessary that Uncle Ben give all his treats.
First line has two integers N (1 = N = 100000), number of children and K (1 = N = 107), number of treats Uncle Ben has. The second line contains N integers sepearated by single space, c1, c2, .... ,cn (1 = ci = 106) where ci is the number of treats ith children has.
Output maximum number of children that have equal number of treats.
Input: 4 5 5 5 3 1 Output: 3 Explanation: Uncle Ben gives two treats to 3rd child. So 3 children have five treats each.
There is no way that more than 3 children can have equal treats.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll