/**
 * Find the minimum flight time given the distance to travel and the speeds of two aircraft.
 *
 * @param distance The distance to travel in kilometers.
 * @param speed1 The speed of the first aircraft in kilometers per hour.
 * @param speed2 The speed of the second aircraft in kilometers per hour.
 * @return The minimum flight time in hours.
 */
fun findMinimumFlightTime(distance: Double, speed1: Double, speed2: Double): Double {

    var remainingDistance = distance

    // Find the time taken by the first aircraft to travel half of the distance
    val time1 = remainingDistance / (2 * speed1)

    // Update the remaining distance
    remainingDistance -= (speed1 * time1)

    // Find the time taken by the second aircraft to travel the remaining distance
    val time2 = remainingDistance / speed2

    // Calculate the total flight time
    val totalTime = time1 + time2

    return totalTime
}

// Example usage
val distance = 1000.0  // kilometers
val speed1 = 150.0  // km/h
val speed2 = 200.0  // km/h

val flightTime = findMinimumFlightTime(distance, speed1, speed2)
/**
 * Find the minimum flight time given the distance to travel and the speeds of two aircraft.
 *
 * @param distance The distance to travel in kilometers.
 * @param speed1 The speed of the first aircraft in kilometers per hour.
 * @param speed2 The speed of the second aircraft in kilometers per hour.
 * @return The minimum flight time in hours.
 */
fun findMinimumFlightTime(distance: Double, speed1: Double, speed2: Double): Double {
/**
 * Find the minimum flight time given the distance to travel and the speeds of two aircraft.
 *
 * @param distance The distance to travel in kilometers.
 * @param speed1 The speed of the first aircraft in kilometers per hour.
 * @param speed2 The speed of the second aircraft in kilometers per hour.
 * @return The minimum flight time in hours.
 */
fun findMinimumFlightTime(distance: Double, speed1: Double, speed2: Double): Double {

    var remainingDistance = distance

    // Find the time taken by the first aircraft to travel half of the distance
    val time1 = remainingDistance / (2 * speed1)

    // Update the remaining distance
    remainingDistance -= (speed1 * time1)

    // Find the time taken by the second aircraft to travel the remaining distance
    val time2 = remainingDistance / speed2

    // Calculate the total flight time
    val totalTime = time1 + time2

    return totalTime
}

// Example usage
val distance = 1000.0  // kilometers
val speed1 = 150.0  // km/h
val speed2 = 200.0  // km/h

val flightTime = findMinimumFlightTime(distance, speed1, speed2)