#C12750. Minimum, Maximum and Median Finder
Minimum, Maximum and Median Finder
Minimum, Maximum and Median Finder
Given a list of integers, compute the minimum, maximum, and median values of the list. The median is defined as follows:
- If the number of integers is odd, the median is the middle element of the sorted list.
- If the number of integers is even, the median is computed as \(\frac{a+b}{2}\), where \(a\) and \(b\) are the two middle elements.
If the input list is empty, output None None None
(without quotes).
inputFormat
The first line of input contains an integer n
representing the number of integers. If n
is greater than 0, the second line contains n
space-separated integers.
outputFormat
Output three values separated by a space: the minimum, maximum, and median of the list. For an even number of elements, the median should be output as a floating-point number if necessary. If the list is empty, output None None None
.
0
None None None