#K32972. Total Expected Cost
Total Expected Cost
Total Expected Cost
You are given N projects. Each project has an estimated cost range represented by two integers L and U. The expected cost for a project is defined as the average of its cost range, i.e. \(\frac{L + U}{2}\). Your task is to compute the total expected cost for all projects combined and print the result rounded to exactly two decimal places.
Input Format:
- The first line contains an integer
N
, the number of projects. - This is followed by
N
lines, each containing two space-separated integersL
andU
, representing the cost range of a project.
Output Format:
- Print a single line containing the total expected cost rounded to two decimal places.
For example, if a project has a cost range of [10, 20], its expected cost is \(\frac{10 + 20}{2} = 15.00\).
inputFormat
The input is given via standard input (stdin) as follows:
- The first line contains an integer
N
(number of projects). - Each of the following
N
lines contains two integersL
andU
(the lower and upper bound of the cost range for each project).
outputFormat
The output, printed to standard output (stdout), is the total expected cost of all projects rounded to two decimal places.
## sample1
10 20
15.00
</p>