#K73892. Evaluate Financial Portfolios
Evaluate Financial Portfolios
Evaluate Financial Portfolios
This problem involves analyzing financial portfolios. For each portfolio, you are given a set of assets with their respective return rates and a benchmark return rate. Your task is to calculate the average return of the assets, round it to two decimal places, and then compare it with the rounded benchmark.
Formally, if a portfolio has asset returns \(r_1, r_2, \ldots, r_n\), then the average return is given by:
\(\text{avg} = \frac{\sum_{i=1}^{n} r_i}{n}\)
If \(\text{round}(\text{avg}, 2) > \text{round}(\text{benchmark}, 2)\), output "outperforms". If it is less, output "underperforms". Otherwise, output "matches".
inputFormat
The first line of input contains an integer T, representing the number of portfolios. For each portfolio, the first line contains an integer N, the number of assets in the portfolio. The following N lines each contain an asset name (a string without spaces) and a return rate (a floating-point number), separated by a space. The last line for the portfolio contains a floating-point number representing the benchmark return rate.
outputFormat
For each portfolio, output a single line containing one of the following strings: "outperforms", "underperforms", or "matches", based on the evaluation result.## sample
1
3
StockA 5.00
StockB 7.50
StockC 3.00
5.00
outperforms
</p>