← 返回 coinbase 的题目列表Finding Cheapest Dishes at Restaurants
类型:online_judge
Given a series of restaurant addresses and their dish information, you are required to find the cheapest dish at each restaurant.
Input:
restaurants: (List[Tuple[str, List[Tuple[str, float]]]]) A list of tuples, each including the restaurant's name and a list of dishes. Each dish is represented as a tuple containing a dish name and its price.
Requirements:
Find the cheapest dish for each restaurant.
Output:
Return a list composed of tuples (restaurant name, cheapest dish name, price).
Example:
restaurants = [
("Restaurant A", [("Dish 1", 12.50), ("Dish 2", 10.00), ("Dish 3", 15.25)]),
("Restaurant B", [("Dish 1", 11.00), ("Dish 2", 8.00), ("Dish 3", 12.00)])
]
Output:
[ ("Restaurant A", "Dish 2", 10.00), ("Restaurant B", "Dish 2", 8.00) ]
Example
Input
"Restaurant A", "Dish 1", 12.50, "Dish 2", 10.00, "Dish 3", 15.25; "Restaurant B", "Dish 1", 11.00, "Dish 2", 8.00, "Dish 3", 12.00