






"""simple docstring"""



from math import isclose, sqrt




def      _lowerCAmelCase		(							UpperCAmelCase__       :					int,						UpperCAmelCase__       :					Optional[int],						UpperCAmelCase__       :					int      )		->tuple[float, float, float]:
						A__						:  List[str]		  =  point_y / 4 / point_x
						A__						:  Union[str, Any]		  =  2 * normal_gradient / (1 + normal_gradient * normal_gradient)
						A__						:  int		  =  (1 - normal_gradient * normal_gradient) / (
						    1 + normal_gradient * normal_gradient
						)
						A__						:  Optional[Any]		  =  (sa - ca * incoming_gradient) / (ca + sa * incoming_gradient)

						# to find the next point, solve the simultaeneous equations:
						# y^2 + 4x^2 = 100
						# y - b = m * (x - a)
						# ==> A x^2 + B x + C = 0
						A__						:  List[Any]		  =  outgoing_gradient**2 + 4
						A__						:  Dict		  =  2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
						A__						:  Any		  =  (point_y - outgoing_gradient * point_x) ** 2 - 1_0_0

						A__						:  str		  =  (
						    -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term      )
						) / (2 * quadratic_term)
						A__						:  Tuple		  =  (
						    -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term      )
						) / (2 * quadratic_term)

						# two solutions, one of which is our input point
						A__						:  Optional[int]		  =  x_minus if isclose(__snake_case,						__snake_case      ) else x_plus
						A__						:  str		  =  point_y + outgoing_gradient * (next_x - point_x)

						return next_x, next_y, outgoing_gradient




def      _lowerCAmelCase		(							UpperCAmelCase__       :					Any = 1.4,						UpperCAmelCase__       :					Union[str, Any] = -9.6      )		->int:
						A__						:  List[str]		  =  0
						A__						:  List[Any]		  =  first_x_coord
						A__						:  Dict		  =  first_y_coord
						A__						:  Any		  =  (1_0.1 - point_y) / (0.0 - point_x)

						while not (-0.01 <= point_x <= 0.01 and point_y > 0):
												A__  ,  A__  ,  A__						:  Tuple		  =  next_point(__snake_case,						__snake_case,						__snake_case      )
												num_reflections += 1

						return num_reflections


if __name__ == "__main__":
						print(F'{solution() = }')














"""simple docstring"""



def      _lowerCAmelCase		(							UpperCAmelCase__       :					str,						UpperCAmelCase__       :					List[Any]      )		->List[Any]:
						A__						:  Union[str, Any]		  =  [1]
						for i in range(2,						UpperCAmelCase__      ):
												factorials.append(factorials[-1] * i      )
						assert 0 <= k < factorials[-1] * n, "k out of bounds"

						A__						:  Optional[int]		  =  []
						A__						:  List[str]		  =  list(range(UpperCAmelCase__      )      )

						# Find permutation
						while factorials:
												A__						:  Optional[int]		  =  factorials.pop()
												A__  ,  A__						:  Optional[int]		  =  divmod(UpperCAmelCase__,						UpperCAmelCase__      )
												permutation.append(elements[number]      )
												elements.remove(elements[number]      )
						permutation.append(elements[0]      )

						return permutation


if __name__ == "__main__":
						import doctest

						doctest.testmod()






