Main page Tasks Volumes Ranking Help

Back to task list

Average of an Array

Average (or mean) value of some numbers could be calculated as their sum divided by their amount. For example:

avg(2, 3, 5) = (2 + 3 + 7) / 3 = 4
avg(20, 10) = (20 + 10) / 2 = 15

You will be given several arrays, for each of which you are to find an average value.

Input data will contain the number of test-cases in the first line. Then test-cases themselves will follow, one case per line. Each test-case describes an array of positive integers with value of 0 marking end. (this zero should not be included into calculations). Answer should contain average values for each array, rounded to integer (see task on rounding), separated by spaces. The example follows:

input data:
3
2 3 5 0
20 10 0
1 0

answer:
4 15 1
You need to login to get test data and submit solution.