RCKTFUEL - Getting a rocket off the ground
In order to get a rocket off the ground, you need to have the right amount of fuel.
This needs to account for the weight of the rocket itself, the weight of the contents, and the weight of the fuel.
For each unit of weight, we require 1/4 as much weight in fuel. Obviously, you then need to account for the weight of the fuel, and the weight of the extra fuel you need to lift the weight of the fuel, and the weight of the extra fuel you need to lift the extra fuel ...
Input
A series of N integers (N < 100), one per line, representing the weight of the rocket, and the weight(s) of the payload(s).
Output
A single integer representing the amount of fuel required to lift the rocket off the ground.
Example
Input: 5
5
Output: 4
Input: 1255
234
12555
45322342
32
Output: 15112140
Added by: | handee |
Date: | 2020-06-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |