Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Keep the Apples

Limits 1s, 512 MB

Suppose you have n bags of apples and one type of basket. In each of those baskets, you can keep at most m apples. Suppose that you have infinitely many baskets of that type. You need to put the apples from the bags into the baskets. What is the minimum number of baskets you need?


First line of the input contains n, m ( 1 < n, m < 1000, n is the number of bags and m is the number of apples each basket can contain). In the following line there are n space separated integers each means ai (1 < i < n, 1 < ai < 50) where ai is the number of apples i-th bag has.


Just print a line that contains the minimum number of baskets you need. See sample input-outputs for more clarification.


2 3
1 2



    91% Solution Ratio

    sakibalaminEarliest, Nov '17

    Tarik.amtolyFastest, 0.0s

    Tofsir_IULightest, 0 B

    ShadmanSahilShortest, 100B


    Login to submit