#K40457. Find the Highest Score

    ID: 26646 Type: Default 1000ms 256MiB

Find the Highest Score

Find the Highest Score

You are given an integer n representing the number of participants, followed by n integers which denote the scores achieved by the participants. Your task is to compute the highest score among the given values. If there are no participants (n = 0), the highest score is defined to be 0.

You can express the solution mathematically as:

[ \text{Highest Score} = \begin{cases} 0, & \text{if } n = 0 \ \max(s_1, s_2, \ldots, s_n), & \text{if } n \ge 1 \end{cases} ]

Note: The input is provided in two lines where the first line contains the integer n and the second line contains n space-separated integers. The output should be the highest score followed by a newline.

inputFormat

The input is provided from the standard input (stdin). The first line contains a single integer n, the number of participants. The second line contains n space-separated integers representing the scores obtained by each participant. If n is 0, the second line may be empty.

outputFormat

Output the highest score among the given list of scores to the standard output (stdout) followed by a newline. If there are no participants, output 0.## sample

5
450 7850 6200 9900 2500
9900

</p>