Given three positive integers a, b and d. You are currently at origin (0, 0) on infinite 2D coordinate plane. You are allowed to jump on any point in the 2D plane at euclidean distance either equal to a or b from your current position. The task is to find the minimum number of jump required to reach (d, 0) from (0, 0).
Input : a = 2, b = 3, d = 1 Output : 2 First jump of length a = 2, (0, 0) -> (1/2, √15/2) Second jump of length a = 2, (1/2, √15/2) -> (1, 0) Thus, only two jump are required to reach (1, 0) from (0, 0). Input : a = 3, b = 4, d = 11 Output : 3 (0, 0) -> (4, 0) using length b = 4 (4, 0) -> (8, 0) using length b = 4 (8, 0) -> (11, 0) using length a = 3
Please refer complete article on Number of jump required of given length to reach a point of form (d, 0) from origin in 2D plane for more details!
- Python | Farthest point on horizontal lines in 2D plane
- Python Program for Minimum number of jumps to reach end
- Python Program to Count ways to reach the n'th stair
- Python Program for Program to Print Matrix in Z form
- Python regex | Check whether the input is Floating point number or not
- Python Program for focal length of a spherical mirror
- Python program to print even length words in a string
- Python Program for Efficient program to print all prime factors of a given number
- Python Program to Find the Number Occurring Odd Number of Times
- Python Program for How to check if a given number is Fibonacci number?
- Python Program for nth Catalan Number
- Python Program for factorial of a number
- Python Program for n-th Fibonacci number
- Python Program for Find sum of odd factors of a number
- Python Program to check Armstrong Number