Calculate Fuel for Advanced Spaceship

MATH

### Problem

Given an integer `distance`

, representing the distance to be traveled, calculate the total fuel needed for an advanced spaceship. The fuel calculation is based on these rules:

- For the first 100 units of distance, the spaceship requires 3 times the fuel.
- For the next 200 units (from 101 to 300), it requires 5 times the fuel.
- For any distance beyond 300 units, it requires 7 times the fuel.
- There is always a minimum fuel reserve of 50 units required, regardless of the distance.

### Examples

`advancedSpaceshipFuel(10) // 80 advancedSpaceshipFuel(110) // 560 advancedSpaceshipFuel(350) // 2050`

Loading...