Problem Statement
Jackson is head ranger at the zoo, which looks after many manic monkeys.
Every day, Jackson needs to buy enough bananas to placate the monkeys, so they do not start a monkey uprising.
Jackson can only buy bananas in packs of . How much money must Jackson spend?
Input
Your first line of input will contain two space-separated integers, and : the number of monkeys and the dollar cost for bananas, respectively.
Next, lines will follow, each containing a single integer : the number of bananas needed to placate monkey .
Output
A single line, containing the total cost of bananas Jackson has to buy, in dollars.
Constraints
For all test cases...
Example
Input
4 6
15
8
31
42
Output
60
Explanation
Jackson needs to buy at least bananas.
Jackson will have to buy at least packs of bananas (a grand total of bananas) to satisfy the need for banana.
Since each pack of bananas costs dollars, this will cost Jackson a total of dollars.
Python Template
n, c = map(int, input().split())
a = [int(input()) for _ in range(n)]
# Continue your code here and print your final answer!
Solution
If you'd like to view a sample solution to this tutorial question, please click the "Read Editorial" link to the right of the problem!
Comments