728x90
반응형
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); StringTokenizer st; int N = Integer.parseInt(br.readLine()); int[] input = new int[N]; st = new StringTokenizer(br.readLine()); for (int i = 0; i < N; i++) { input[i] = Integer.parseInt(st.nextToken()); } Arrays.sort(input); System.out.print(input[0] + " "); System.out.println(input[N - 1]); } } | cs |
728x90
반응형
'알고리즘 > 알고리즘 기초문제(백준-입출력)' 카테고리의 다른 글
[백준]2439_별 찍기 - 2 (0) | 2022.02.15 |
---|---|
[백준]2438_별 찍기 - 1 (0) | 2022.02.15 |
st-> readLine() |vs| str->read() (0) | 2022.02.15 |
[백준]8393_합 (0) | 2022.02.15 |
[백준]2739_구구단 (0) | 2022.02.15 |