------
## 最终结论
```python
import heapq

def minCostToHireWorkers(quality, wage, K):
    # Create a list of workers with their quality and wage ratio
    workers = []
    for i in range(len(quality)):
        workers.append((wage[i] / quality[i], quality[i]))
    
    # Sort workers by their wage-to-quality ratio
    workers.sort()
    
    # Initialize a max-heap to keep track of the largest qualities
    max_heap = []
    total_quality = 0
    min_cost = float('inf')
    
    for ratio, qual in workers:
        # Add the current worker's quality to the heap and total quality
        heapq.heappush(max_heap, -qual)
        total_quality += qual
        
        # If we have more than K workers, remove the one with the highest quality
        if len(max_heap) > K:
            total_quality += heapq.heappop(max_heap)
        
        # If we have exactly K workers, calculate the cost
        if len(max_heap) == K:
            min_cost = min(min_cost, total_quality * ratio)
    
    return min_cost

# Example usage:
print(minCostToHireWorkers([10,20,5], [70,50,30], 2))  # Output: 105.00000
print(minCostToHireWorkers([3,1,10,10,1], [4,8,2,2,7], 3))  # Output: 30.66667
```