forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path4.java
More file actions
28 lines (22 loc) Β· 813 Bytes
/
4.java
File metadata and controls
28 lines (22 loc) Β· 813 Bytes
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
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// N, Mμ 곡백μ κΈ°μ€μΌλ‘ ꡬλΆνμ¬ μ
λ ₯ λ°κΈ°
int n = sc.nextInt();
int m = sc.nextInt();
int result = 0;
// ν μ€μ© μ
λ ₯ λ°μ νμΈνκΈ°
for (int i = 0; i < n; i++) {
// νμ¬ μ€μμ 'κ°μ₯ μμ μ' μ°ΎκΈ°
int min_value = 10001;
for (int j = 0; j < m; j++) {
int x = sc.nextInt();
min_value = Math.min(min_value, x);
}
// 'κ°μ₯ μμ μ'λ€ μ€μμ κ°μ₯ ν° μ μ°ΎκΈ°
result = Math.max(result, min_value);
}
System.out.println(result); // μ΅μ’
λ΅μ μΆλ ₯
}
}