AIOC Banner

Problem: A Dish Best Served Cold

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.

A Dish Best Served Cold

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:


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.

Sample Input 1


Sample Output 1

50 75 69

Sample Input 2


Sample Output 2

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-2023

Page generated:  3 June 2023,  2:38pm AEST