#C546. Calculate Pizza Cost
Calculate Pizza Cost
Calculate Pizza Cost
You are given the details of various cheeses and toppings available for pizza. Each cheese and topping has an associated cost. Your task is to determine the total cost of a pizza based on the selected cheese and a list of toppings chosen.
The input consists of several lines. First, you'll be given the number of cheese types available along with their prices. Then, you'll be provided the number of available toppings along with their costs. After that, the selected cheese and a list of selected toppings are provided. Calculate the total cost of the pizza by summing up the cost of the selected cheese and the cost of all chosen toppings.
Note: Use the following formula:
\( \text{total cost} = \text{cheese cost} + \sum_{i=1}^{N} \text{topping cost}_i \)
inputFormat
The input is provided via standard input (stdin) and consists of multiple lines. The structure is as follows:
- An integer C representing the number of available cheese types.
- C lines follow, each containing a cheese name (string) and its price (float) separated by a space.
- An integer T representing the number of available toppings.
- T lines follow, each containing a topping name (string) and its cost (float) separated by a space.
- A line containing the name (string) of the selected cheese.
- An integer N representing the number of selected toppings.
- N lines follow, each containing the name (string) of one selected topping.
outputFormat
Output a single line to standard output (stdout) containing a float value representing the total cost of the pizza.## sample
2
Mozzarella 1.5
Parmesan 2.0
3
Pepperoni 0.5
Olives 0.25
Mushrooms 0.4
Mozzarella
2
Pepperoni
Olives
2.25