#K59257. Total Cost Calculation of Multiple Orders

    ID: 30824 Type: Default 1000ms 256MiB

Total Cost Calculation of Multiple Orders

Total Cost Calculation of Multiple Orders

You are given multiple orders from a restaurant. Each order consists of several items where each item has a name, a quantity, and a price per unit. Your task is to compute the total cost of all orders. The computation involves the following steps:

  • For each order, calculate the cost by multiplying the quantity and unit price for every item, and then summing these values.
  • Sum the costs of all orders and round the result to two decimal places.

The input is provided via standard input (stdin) and the output should be printed to standard output (stdout). Please note that, if any formulas are needed, they should be written in LaTeX format. For example, the cost of an order with items is given by:

$$cost = \sum_{i=1}^{m} (quantity_i \times price_i) $$

and the total cost is:

total_cost=order=1ncostordertotal\_cost = \sum_{order=1}^{n} cost_{order}

inputFormat

The input is read from standard input and has the following format:

T
M1
item1 quantity1 price1
item2 quantity2 price2
... (M1 items)
M2
item1 quantity1 price1
... (M2 items)
...

Where:

  • T is the number of orders.
  • For each order, M is the number of items in that order.
  • Each item description consists of a string (the item name), an integer (the quantity), and a floating point number (the price per unit).
  • </p>

    outputFormat

    The output should be the total cost of all orders, rounded to two decimal places, printed to standard output.

    ## sample
    2
    3
    burger 2 5.00
    fries 1 2.50
    cola 1 1.25
    2
    pizza 1 10.00
    water 2 1.00
    25.75