MILK MAN AND HIS BOTTLES | Code vita 2015


Problem Description

A Milkman serves milk in packaged bottles of varied sizes. The possible size of the bottles are {1, 5, 7 and 10} litres. He wants to supply desired quantity using as less bottles as possible irrespective of the size. Your objective is to help him find the minimum number of bottles required to supply the given demand of milk.

Input Format:

First line contains number of test cases N Next N lines, each contain a positive integer Liwhich corresponds to the demand of milk.

Output Format:

 For each input Li, print the minimum number of bottles required to fulfill the demand

Constraints:

1 <= N <= 1000 Li > 0 1 <= i <= N

Input

2
17
65

Output

2
7

Explanation:

Number of test cases is 2
For 17 = 10*1 + 7*1 = 2
For 65 = 10*6 + 5*1 = 7

Few more examples:

For 99 = 10*9 + 7*1 + 1*2 = 12
For 63 = 10*6 + 1*3 =9

No comments:

Post a Comment

DISTRIBUTE BOOKS | Code vita 2019

Problem Description  For enhancing the book reading, school distributed story books to students as part of the Children’s day celebration...