#C4729. Car Fuel Status Determination
Car Fuel Status Determination
Car Fuel Status Determination
Given the current fuel level in a car, the distance to the next gas station, and the car's total fuel capacity, determine if the car can reach the gas station. The car's fuel status is determined by the following conditions:
- If the distance to the gas station is greater than 2 \( \times \) fuel capacity, then the station is unreachable: output
Cannot reach
. - If the fuel level is less than or equal to 0 or is less than the distance, the car needs a refill: output
Needs refill
. - Otherwise, the fuel is sufficient, and the car can reach the gas station: output
Can reach
.
Note that the formula for the unreachable condition is given in LaTeX format as \( distance > 2 \times fuel\_capacity \).
inputFormat
The input consists of a single line containing three space-separated integers: fuel
(the current fuel level), distance
(the distance to the next gas station), and fuel_capacity
(the maximum fuel tank capacity).
outputFormat
Output a single line containing one of the following strings based on the conditions: Can reach
, Needs refill
, or Cannot reach
.
10 5 20
Can reach