Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In Santa's village it is a tradition that after a successful Christmas and the distribution of all gifts to the children of the world, each elf also receives a gift from Santa himself. This year, Santa has thought to give an extra reward to the elves who took particularly few breaks during their work - wrapping the presents - and therefore worked especially hard. Therefore, he has bought a whole bunch of additional gifts and wants to give the elves who took few breaks a second gift for their efforts. Now, of course, he wonders which elves he should give such a second gift to. He has thought of distributing exactly k extra gifts, so that each of the gifted elves has made at most k breaks. Since Santa Claus
- is a very nice guy, of course as many elves as possible should receive an additional gift. Can you determine how many elves will receive an extra gift from Santa?
- Example Cases :
- Input:
- 1 1 3 6 10
- Output:
- 3
- Input:
- 10 1 5 1 8 6
- Output
- 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement