Question: Scuba Diver Problem in C++ Code A scuba diver uses a special equipment for diving. He has a cylinder with two containers: one with oxygen
Scuba Diver Problem in C++ Code

A scuba diver uses a special equipment for diving. He has a cylinder with two containers: one with oxygen and the other with nitrogen. Depending on the time he wants to stay under water and the depth of diving the scuba diver needs various amount of oxygen and nitrogen. The scuba diver has at his disposal a certain number of cylinders. Each cylinder can be described by its weight and the volume of gas it contains. In order to complete his task the scuba diver needs specific amount of oxygen and nitrogen. What is the minimal total weight of cylinders he has to take to complete the task? Example The scuba diver has at his disposal 5 cylinders described below. Each description consists of: volume of oxygen, volume of nitrogen (both values are given in litres) and weight of the cylinder (given in decagrams): 3 36 12e 10 25 129 5 5e 25e 1 45 13e 4 2e 119 If the scuba diver needs 5 litres of oxygen and 60 litres of nitrogen then he has to take two cylinders of total weight 249 (for example the first and the second ones or the fourth and the fifth ones) Task Write a program that for each test case: reads scuba diver's demand for oxygen and nitrogen, the number of accessible cylinders and their descriptions . computes the minimal total weight of cylinders the scuba diver needs to complete his task outputs the result. Note: the given set of cylinders always allows to complete the given task. Input The number of test cases cis in the first line of input, then ctest cases follow separated by an empty line In the first line of a test case there are two integers a separated by a single space, 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
