wip
Time Limit: 1 seconds
Memory Limit: 1024 MB
Rating: 1000
Problem StatementYou are flying in your spaceship but have to refuel. There is a unknown number of different fuels avaliable at a fuel station. Each fuel has a energy, $e$, which describes how many light years you can travel with one litre of fuel and a cost per litre, $c$. Given that your next destination is $9840000$ light years away, find the cheapest fuel which gets you there. Fuel can be bought to exact amounts at fuel stations for the spaceship to reach the destination with zero fuel to spare.
InputInputs from the list of fuels are in the format 'e,c' where e is energy and c is cost. Inputs will come in the form 'e,c', 'e,c'. A string including values in single quotations separated by commas, with a space in between the comma and the next value.
OutputOutputs will come in the format "The most efficient fuel is fuel No. [n]", where n is the most efficient fuel in the list.
Sample CasesSample Input 0: '45,5', '33,4', '76,6' Sample Output 0: The most efficient fuel is fuel No. 3Explanation
The total cost spent to buy the exact amount of fuel 3 needed to travel $9840000$ light-years is $776842.10$, which is the cheapest out of all 3 options. Therefore, fuel 3 is the most efficient.
SourcesKL Coding Cup October 2024 > Problem 7
Submit | Back