Want to try solving this problem? You can submit your code online if you log in or register.

*
The problems in this set are designed to be more accessible to beginning coders. As a learning aid, walkthroughs discussing how to solve the problems in this set are available by clicking on this link.
On completion of this problem set, students should be able to use loops (for example while and for loops) to simulate processes and analyse large data sets.
*

**Input File:** `dishin.txt`

**Output File:** `dishout.txt`

**Time Limit:** 1 second

You do not like statisticians, and statisticians do not like you. Ever since that life actuary kicked sand into your ice cream when you were four, you have waged a slowly escalating war against those number-crunching jerks. But all that is about to change.

After many sleepless nights you have conceived the ultimate revenge: beating them at their own game. Using your computer programming skills, you will write a freeware statistics package so thorough, so complete, that statisticians all around the world will be out of a job. It will be able to predict weather patterns, calculate life expectancies, and even play the perfect poker game.

First, though, you must implement word wrap. However, this task is rather finicky, not very mathematical in nature, and ultimately not very important. More urgently, you also need to implement some basic data analysis. Specifically, you decide to write a test program that takes a data set (a list of integers) and calculates the following measures of spread:

*Minimum*- the smallest value in the list. For example, the minimum of the numbers {5, 6, 5, 3} is 3.*Maximum*- the largest value in the list. For example, the maximum of the numbers {5, 6, 5, 3} is 6.*Mean*(or*average*) - defined as the sum of everything in the list divided by the number of items in the list. For example, the mean of the numbers {5, 6, 5, 3} is (5+6+5+3)/4 = 19/4 = 4.75. However for simplicity you are asked to round all answers down to the nearest whole number. So the mean of the numbers {5, 6, 5, 3}, rounded down, is 4.

The first line of input will consist of a single integer *n* (1 <= *n* <= 1,000), the size of your data set. The following *n* lines will describe the data set. Each of these lines contains an integer between 0 and 1,000,000 inclusive.

The output file should consist of three integers separated by spaces: the minimum, maximum and mean of the data set.

6 70 72 74 50 73 75

50 75 69

6 100 200 200 200 200 1100

100 1100 333

The score for each input file will be 100% if the correct answer is written to the output file and 0% otherwise. Cower in fear, statisticians. Your time is nigh.

Privacy
statement

© Australian Mathematics Trust 2001-2022

Page generated: 25 September 2022, 2:26am AEST