Spaceship Speed Control

# Introduction In this challenge, we will help Tom solve a problem with his magical spaceship. The spaceship has two pedals - the throttle and the brake. By pressing the throttle, the spaceship's speed increases to X \* X, and by pressing the brake, the speed decreases to Y - 1. Tom needs to find the minimum number of times he needs to press the pedals to reach a target speed M. Can you help him summon a divine dragon to fulfill his wish of finding a girlfriend for his space voyage?

|60 : 00

Click the virtual machine below to start practicing