연관문제
최소, 최대 - 백준 10818번
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Ar {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int size = Integer.parseInt(br.readLine());
String[] numbers = (br.readLine()).split(" ");
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for (String s : numbers) {
int i = Integer.parseInt(s);
if (i < min) {
min = i;
}
if (i > max) {
max = i;
}
}
System.out.println(min + " " + max);
}
}