#T531. 查找最值

查找最值

Description

Read nn integers from the keyboard, then find the maximum and minimum values among these nn integers, along with their positions.

Input Format

The first line contains an integer n (n < 100);
The second line contains n integers separated by spaces (each number is in the range [1, 1000]).

Output Format

The first line outputs the maximum value and its position, separated by a space;
The second line outputs the minimum value and its position, separated by a space.

5
5 3 6 2 4
6 3 
2 4

译文

CodesOnline