Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Milkman serves milk in packaged bottles of varied sizes. The possible size of the bottles are { 1 , 5 , 7 and 1 0

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 the desired quantity using as fewer 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 for milk.
Input Format:
The first line contains the number of test cases N
Next N lines, each contains a positive integer Li which corresponds
to the demand of milk.
Output Format:
For each input Li, print the minimum number of bottles required to fulfil the demand
Constraints:
1<= N <=1000 Li >01<= i <= N
Sample Input and Output:
2
17
65
27
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
Concepts applied: Data types, Operators, I/O functions, and Loops. in c++

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions