here is a promotional offer in a bookstore "Take 3, pay for the 2 more expensive ones". So, each custon ho picks 33 books gets the cheapest one for free. Of course, the customer can take even more books epending on the way the books are arranged into groups of three, get the cheapest one in each group ree. or example, let the prices of the books taken by the customer be: 2,3,4,4,6,9,102,3,4,4,6,9,10. If he arran nem into the groups (10,3,2)(10,3,2), (4,6,4)(4,6,4) and (9)(9), he will get the book priced 22 from the first roup for free and the book priced 44 from the second group. We can see that he will not get anything ree from the third group because it contains only one book. he lady working in the bookstore is well-intentioned and she always wants to lower the price for each ustomer as much as possible. For given book prices, help the lady arrange the books into groups in the est way possible, so that the total price the customer has to pay is minimal. lease note: The lady doesn't have to arrange the books into groups so that each group contains exactl ooks, but the number of books in a group needs to be between 11 and 33, inclusively. nput he first line of input contains the integer NN (1
here is a promotional offer in a bookstore "Take 3, pay for the 2 more expensive ones". So, each custon ho picks 33 books gets the cheapest one for free. Of course, the customer can take even more books epending on the way the books are arranged into groups of three, get the cheapest one in each group ree. or example, let the prices of the books taken by the customer be: 2,3,4,4,6,9,102,3,4,4,6,9,10. If he arran nem into the groups (10,3,2)(10,3,2), (4,6,4)(4,6,4) and (9)(9), he will get the book priced 22 from the first roup for free and the book priced 44 from the second group. We can see that he will not get anything ree from the third group because it contains only one book. he lady working in the bookstore is well-intentioned and she always wants to lower the price for each ustomer as much as possible. For given book prices, help the lady arrange the books into groups in the est way possible, so that the total price the customer has to pay is minimal. lease note: The lady doesn't have to arrange the books into groups so that each group contains exactl ooks, but the number of books in a group needs to be between 11 and 33, inclusively. nput he first line of input contains the integer NN (1
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 20PE: When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making...
Related questions
Question
In C please
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr