'Python: Find the minimum number of seconds required to make speed of vehicle equals to zero or s=0?

#Dear all, could you help me please with this task to solve and find a code solution in Python?

#An engineer is calculating performance of a brake system for a vehicle. He wants to determine in how many seconds the brake system stops the vehicle or take the speed of the vehicle to 0. (s means SPEED of vehicle, b means BRAKE INTENSITY)

#There are 2 operations which can be performed in brake system

#Each operations take 1 sec to complete. These operations can’t happen in parallel. Your program can choose to perform any of the 2 operations at each step.

Find the minimum number of seconds required to make speed of vehicle equals to zero or s=0.

Input Format

#Each test case consists of a single line containing 2 integers. First Speed and second Brake Intensity.

s=>1, 
b<=10**9;

#Speed and Brake Intensity range -

s>=1, 
b=<10**9;

Output Format

For each test case print a single integer i.e. minimum number of seconds required to make the speed of the vehicle to 0.

Test Case 0: s = 9 and b = 2 In above test case, one of the optimal solutions is:

#Divide s by b. After this operation

s=4,
b=2

: #Divide s by b. After this operation

s=2,
b=2;

#Increase b. After this operation

s=,
b=3;

#Divide s by b. After this operation

s=0,
b=3;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source