#C14801. Find the Largest Number in a List
Find the Largest Number in a List
Find the Largest Number in a List
You are given a list of integers. Your task is to find the largest number in this list. If the list is empty, output None
.
Mathematically, for a list \(a_1, a_2, \dots, a_n\) where \(n > 0\), you need to compute \(\max(a_1, a_2, \dots, a_n)\). If \(n = 0\), output None
.
inputFormat
The input is given from standard input (stdin) and consists of two parts:
- The first line contains an integer \(n\) representing the number of elements in the list.
- If \(n > 0\), the second line contains \(n\) integers separated by spaces.
If \(n = 0\), no further input is provided.
outputFormat
Output the largest integer from the list to standard output (stdout). If the list is empty, output None
(without quotes).
5
1 2 3 4 5
5