Company: Barclays
Difficulty: medium
Nuclear Reactor Energy Optimization C++14 GCC 5.5.0 Dr. Victor Frankenstein has quit the monster creation business. Nuclear energy now strikes his fantasy. He has created a fission reactor that takes radioactive materials in a liquid state. The capacity of the reactor is \'V\' gallons. He has \'N\' vials of radioactive liquids, each with some mass and some volume. Some units of energy are produced when a liquid is poured into the reactor. Victor would like to maximize the energy output. However, there is a catch. Upon studying the physics and history of atomic elements, he realizes that the combined mass of the radioactive liquids inside the reactor must not exceed a certain critical mass \'M\' or else the reaction would get out of control and cause a violent explosion. Write an algorithm that will help Victor get the maximum energy from the reactor without losing his life. Input Format First line: Integer reactCapacity representing reactor capacity(V) Second line: Integer criticalMass