반응형
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
26
27
28
29
30
31
32
|
/*
* Author : Jeonghun Cho
* Date : December 3, 2019
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int size = Integer.parseInt(br.readLine());
String[] str = br.readLine().split(" ");
int[] answer = new int[size];
int maxNumber = -1000000;
int minNumber = 1000000;
for(int i=0; i<size; i++) {
answer[i] = Integer.parseInt(str[i]);
if(maxNumber < answer[i] ) {
maxNumber = answer[i];
}
if(minNumber >= answer[i]) {
minNumber = answer[i];
}
}
System.out.println(minNumber+" "+maxNumber);
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
반응형
'알고리즘 > 백준' 카테고리의 다른 글
[백준] 2577 숫자의 개수 (Java) (0) | 2019.12.03 |
---|---|
[백준] 2562 최댓값 (Java) (0) | 2019.12.03 |
[백준] 1110 더하기 사이클 (Java) (0) | 2019.12.03 |
[백준] 10951 A + B - 4 (Java) (0) | 2019.12.02 |
[백준] 10952 A + b - 5 (Java) (0) | 2019.12.02 |