Minions' Master
Time limit3sMemory limit256 MB
For each town, compute the average power and the percentage of residents above it, rounded to three decimals.
- Level
Easy2 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
The minions go from town to town looking for a new master. Bob, who is far too eager, found a power meter in a cave. The meter shows the power of a person as a number. In each town the minions measure the power of every resident, then compute the average power of the town and the percentage of residents whose power is greater than that average.
For example, town A has 5 residents and the meter reads 50, 150, 70, 180, and 100. The average power is 110, and 2 residents have power greater than 110. The answer for that town is the average 110 and the percentage 40%.
Input
The first line contains the number of test cases (). data sets follow. Each data set starts with the population of a town (), followed by the powers of the residents separated by spaces. Each power is an integer between 0 and 1000.
Output
For each test case, print the average power and the percentage of residents whose power is greater than the average on one line. Separate the two values with a single space and put a percent sign after the percentage. Round both values to three decimal places and always print three digits after the decimal point.
Rounding follows the round half up rule: if the discarded part is exactly one half, round up. Many languages do not use this rule by default.