문제링크
https://www.acmicpc.net/problem/20053
package BOJ;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main_20053 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
for(int t=0;t<T;t++){
int N = Integer.parseInt(br.readLine());
int arr[] = new int[N];
StringTokenizer st = new StringTokenizer(br.readLine());
for(int i=0;i<N;i++){
arr[i] = Integer.parseInt(st.nextToken());
}
Arrays.sort(arr);
System.out.println(arr[0]+" "+arr[N-1]);
}
}
}
'알고리즘 > 백준' 카테고리의 다른 글
[JAVA]백준_10814_나이순정렬 (0) | 2021.06.23 |
---|---|
[JAVA]백준_14425_문자열집합 (0) | 2021.06.23 |
[JAVA]백준_9421_소수상근수 (0) | 2021.06.23 |
[JAVA]백준_20114_미아노트 (0) | 2021.06.17 |
[JAVA]백준_5567_결혼식 (0) | 2021.06.17 |