-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_2908.java
More file actions
57 lines (47 loc) ยท 1.42 KB
/
_2908.java
File metadata and controls
57 lines (47 loc) ยท 1.42 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package backjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
// https://www.acmicpc.net/problem/2908
// ์์
public class _2908 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] nums = br.readLine().split(" ");
String[] convertNum = new String[]{"", ""};
// ์ซ์ ๊ฑฐ๊พธ๋ก ๋ง๋ค๊ธฐ
for(int i=0;i<2;i++){
char[] originNum = nums[i].toCharArray();
for(int j=2; j>=0; j--){
convertNum[i] += originNum[j];
}
}
// ์ต๋๊ฐ๊ตฌํ๊ธฐ
// sol1 memory 11488 runtime 76
/*
int max = Integer.parseInt(convertNum[0]);
if(max < Integer.parseInt(convertNum[1])){
max = Integer.parseInt(convertNum[1]);
}
System.out.println(max);
*/
// sol2 Math ๋ฉ์๋ ์ฌ์ฉ memory 11468 runtime 80
// System.out.println(Math.max(Integer.parseInt(convertNum[0]), Integer.parseInt(convertNum[1])));
// sol3 ๋ชจ๋ ๋ณ์๋ก ์ฒ๋ฆฌ memory 11448 runtime 76
int num1 = Integer.parseInt(convertNum[0]);
int num2 = Integer.parseInt(convertNum[1]);
// if(num1 > num2){
// System.out.println(num1);
// }else{
// System.out.println(num2);
// }
// sol4 ๋ชจ๋ ๋ณ์+์ผํญ์ฐ์ฐ์ memory 11540 runtime 76
System.out.println(num1 > num2 ? num1 : num2);
}
}
/*
input
734 893
output
437
*/