Gordon Ramsay has N strange bottles of sauces. The i-th bottle is opened by tapping exactly A¡ times. Ramsay needs to open K bottles as soon as possible for cooking a dish for the customer. As a...


Gordon Ramsay has N strange bottles of sauces. The i-th bottle is opened by tapping<br>exactly A¡ times. Ramsay needs to open K bottles as soon as possible for cooking a dish<br>for the customer. As a challenge someone shuffled the bottles! Ramsay knows the<br>values A;; however, he doesn't know which bottle is which. He'd like to minimize the<br>worst-case number of taps. Create a C++ program to print the minimal number of taps<br>for the worst-case.<br>Input:<br>1<br>21<br>58<br>Output:<br>8<br>

Extracted text: Gordon Ramsay has N strange bottles of sauces. The i-th bottle is opened by tapping exactly A¡ times. Ramsay needs to open K bottles as soon as possible for cooking a dish for the customer. As a challenge someone shuffled the bottles! Ramsay knows the values A;; however, he doesn't know which bottle is which. He'd like to minimize the worst-case number of taps. Create a C++ program to print the minimal number of taps for the worst-case. Input: 1 21 58 Output: 8

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here