- Notifications
You must be signed in to change notification settings - Fork 845
/
Copy path4.java
28 lines (22 loc) · 813 Bytes
/
4.java
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
importjava.util.*;
publicclassMain {
publicstaticvoidmain(String[] args) {
Scannersc = newScanner(System.in);
// N, M을 공백을 기준으로 구분하여 입력 받기
intn = sc.nextInt();
intm = sc.nextInt();
intresult = 0;
// 한 줄씩 입력 받아 확인하기
for (inti = 0; i < n; i++) {
// 현재 줄에서 '가장 작은 수' 찾기
intmin_value = 10001;
for (intj = 0; j < m; j++) {
intx = sc.nextInt();
min_value = Math.min(min_value, x);
}
// '가장 작은 수'들 중에서 가장 큰 수 찾기
result = Math.max(result, min_value);
}
System.out.println(result); // 최종 답안 출력
}
}