Banana 1
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 10. How much money must Jackson spend?
Input
Your first line of input will contain two space-separated integers, n and c: the number of monkeys and the dollar cost for 10 bananas, respectively.
Next, n lines will follow, each containing a single integer ai: the number of bananas needed to placate monkey i.
Output
A single line, containing the total cost of bananas Jackson has to buy, in dollars.
Constraints
For all test cases...
- 1≤n≤106
- 1≤c≤102
- 1≤ai≤105
Example
4 6
15
8
31
42
60
Explanation
Jackson needs to buy at least 15+8+31+42=96 bananas.
Jackson will have to buy at least 10 packs of 10 bananas (a grand total of 10×10=100 bananas) to satisfy the need for 96 banana.
Since each pack of bananas costs 6 dollars, this will cost Jackson a total of 6×10=60 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!
Comments0
No comments yet
Be the first to comment.
New comment
Log in to join the discussion.