Buy Masks solution codechef
You go to a shop to buy masks in this pandemic.
Now, there are 3 different types of packets of mask
- A packet of 10 masks
- A packet of 5 masks
- A packet of 1 mask
You are given the costs of each packet. A packet of 10 masks costs Rs., a packet of 5 masks costs Rs. and a packet of 1 mask costs Rs. .
You need to find the minimum sum of rupees you need to pay to buy a total of exactlymasks from the shop.
NOTE: You can buy any number of each type of packet (can be 0).
Input: Buy Masks solution codechef
- First line will contain , number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input, four integers .
Output: Buy Masks solution codechef
For each testcase, output in a single line minimum Rupees you need to pay to buymasks.
Constraints Buy Masks solution codechef
Sample Input: Buy Masks solution codechef
2 17 10 10 3 19 30 10 1
Test case 1: He will buy 1 packet of 10 masks (cost = Rs
Total cost = 10 + 10 + 6 = Rs. 26
Codechef is an platform built to programmers compete against others in the community and to improve their knowledge by facing various challenges. Challenges are categorised on the basis of their difficulty level , if your rating is above 2000 you are in top tier i.e, Division 3 and if your rating is between 2000 and 1600 you will be in tier 2 i.e, Division 3 and if your rating is below that you will be in lowest tier i.e, Division 3. You can improve your rating by successful submission with minimum penalty.
- Cheems VS Doge solution codechef
- Game of Primes solution codechef
- Books and Friends solution codechef
- Run It Back solution codechef
- How I Met Your Mother solution codechef
Also Read : Neenade Naa song lyrics with English Translation