Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions