import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter (new OutputStreamWriter(System.out));
int N = Integer.parseInt(br.readLine());
int A [] = new int[N];
int max1=0;
int min1=0;
StringTokenizer st = new StringTokenizer(br.readLine());
for(int i=0; i<N; i++) {
int a =Integer.parseInt(st.nextToken());
A[i] =a;
// System.out.println(i);
// System.out.println(A[i]);
}
max1=A[0];
min1=A[0];
for(int i=0; i<N; i++) {
min1 = min(min1, A[i]);
max1 = max(max1, A[i]);
}
System.out.println(min1);
System.out.println(max1);
}
public static int max(int a , int b) {
return (a>=b) ? a : b;
}
public static int min(int a , int b) {
return (a<=b) ? a : b;
}
}
--------------------------------------------------------------------------------------------------
이것도,, 검색,, 함,, ㅠ
'백준알고리즘' 카테고리의 다른 글
백준 11403 경로 찾기 (0) | 2020.04.17 |
---|---|
백준 2577 배열 숫자의 갯수 (0) | 2020.03.19 |
백준10951 EOF (0) | 2020.03.18 |
백준 10952번 While A+B - 5 (0) | 2020.03.16 |
백준 10871번 X보다 작은 수 (0) | 2020.03.02 |
댓글