Question: ARM program It is sometimes tricky to figure out the cheapest way to buy things, even in the supermarket where the price of all goods

ARM program

ARM program It is sometimes tricky to figure out the cheapest way

to buy things, even in the supermarket where the price of all

It is sometimes tricky to figure out the cheapest way to buy things, even in the supermarket where the price of all goods are listed clearly. Just consider what I saw last Saturday about the price of cooking oil: notice the difference in the sizes of the two price tags) Lowest Price in Town! KNAVE CORN OIL 4 x 900mL $72.00 $ 60.00 KNAVE CORN OIL 900mL @ $22.00 Buy 1 get 1 free Having a sharp mind (a consequence of regularly taking part in online programming contests), you should have no problem in seeing that the "buy-1-get-1-free' scheme is preferable. But what about your Mum? It is your responsibility as her son/daughter to write her a program that computes the lowest price to buy things in the supermarket, thus helps her to save money. Input The input consists of more than a hundred test cases, each concerning a different item. The first line of each case give the unit price of buying an item then a non-negative integer M (20) This is followed by M lines each containing two numbers and P (1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!