-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution2.java
More file actions
29 lines (27 loc) · 895 Bytes
/
Copy pathSolution2.java
File metadata and controls
29 lines (27 loc) · 895 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
29
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Solution2 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String input = br.readLine();
String arr[] = input.split(" ");
int answer = 0;
int[] nums = Arrays.asList(arr).stream().mapToInt(Integer::parseInt).toArray();
if(nums[0] + nums[2] < nums[1]){
answer = (nums[0] + nums[2]) * 2;
}
else if(nums[1] + nums[2] < nums[0]){
answer = (nums[1] + nums[2]) *2 ;
}
else{
for (int i = 0; i < nums.length; i++) {
answer += nums[i];
}
if(answer % 2 == 1){
answer -=1;
}
}
System.out.println(answer);
}
}