#K46007. Find the Maximum Element
Find the Maximum Element
Find the Maximum Element
Given a list of integers, your task is to find the maximum element among them using the optimal number of comparisons. If the list is empty, output None
.
The input is read from standard input. The first line contains an integer (N), the number of elements in the array. If (N > 0), the second line contains (N) space-separated integers. Your program should output the maximum value to standard output.
inputFormat
The first line contains an integer (N). If (N > 0), the second line contains (N) space-separated integers.
outputFormat
Output a single line containing the maximum integer from the array. If the array is empty (i.e. (N = 0)), output "None".## sample
6
1 2 3 4 5 6
6