World Languages, asked by Vinitha7844, 10 months ago

Collision course python coding question

Answers

Answered by bhaisora9
0

Answer:

Given five numbers a, b, c, d and n (where a, b, c, d, n > 0). These values represent n terms of two series. The two series formed by these four numbers are b, b+a, b+2a….b+(n-1)a and d, d+c, d+2c, ….. d+(n-1)c

These two series will collide when at any single point summation values becomes exactly the same for both the series.Print the collision point.

Example:

Input : a = 20, b = 2,

c = 9, d = 19,

n = 100

Output: 82

Explanation:

Series1 = (2, 22, 42, 62, 82, 102...)

Series2 = (28, 37, 46, 55, 64, 73, 82, 91..)

So the first collision point is 82.

Similar questions