C++ Programming Problem: Kelvin and Fahrenheit have gotten bored of eating ice cubes, so now they have decided to eat candies instead. Kelvin has X hot candies, and Fahrenheit has Y cold candies....


C++ Programming Problem:<br>Kelvin and Fahrenheit have gotten bored of eating ice cubes, so now they have decided to eat<br>candies instead. Kelvin has X hot candies, and Fahrenheit has Y cold candies. Kelvin and Fahrenheit<br>always want the split of candies to be as fair as possible. The problem is, Kelvin only wants hot<br>candies and Fahrenheit only wants cold candies. Here comes Equilibrium to the rescue! Equilibrium<br>bought an infinite number of candy packs. There are two types of packs: Packs containing exactly C<br>hot candies and Packs containing exactly D cold candies.<br>Equilibrium wants to give some hot candy packs to Kelvin and some cold candy packs to Fahrenheit<br>in such a way that the absolute difference between the number of candies they have is minimized.<br>You are assigned to develop a C++ code that finds out the minimum absolute difference.<br>Test Case<br>Result<br>1<br>1222<br>

Extracted text: C++ Programming Problem: Kelvin and Fahrenheit have gotten bored of eating ice cubes, so now they have decided to eat candies instead. Kelvin has X hot candies, and Fahrenheit has Y cold candies. Kelvin and Fahrenheit always want the split of candies to be as fair as possible. The problem is, Kelvin only wants hot candies and Fahrenheit only wants cold candies. Here comes Equilibrium to the rescue! Equilibrium bought an infinite number of candy packs. There are two types of packs: Packs containing exactly C hot candies and Packs containing exactly D cold candies. Equilibrium wants to give some hot candy packs to Kelvin and some cold candy packs to Fahrenheit in such a way that the absolute difference between the number of candies they have is minimized. You are assigned to develop a C++ code that finds out the minimum absolute difference. Test Case Result 1 1222

Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here