package solved_ac.Bronze;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class B_2309_2 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int[] arr = new int[9];
int sum = 0; // 난쟁이들의 키의 총합
int total = 0; // 키의 총합에서 두명 뺀 수
int not1 = 0; // 가짜 난쟁이 1
int not2 = 0; // 가짜 난쟁이 2
for(int i = 0; i < arr.length; i++){
arr[i] = Integer.parseInt(br.readLine());
sum += arr[i];
}
Arrays.sort(arr);
for(int i = 0; i < 9; i++){
for(int j = i+1; j < 9; j++){
total = sum - arr[i] - arr[j];
if(total == 100){
not1 = i;
not2 = j;
break;
}
}
}
for(int i = 0; i < 9; i++){
if( i == not1 || i == not2){
continue;
}
System.out.println(arr[i]);
}
}
}
'알고리즘' 카테고리의 다른 글
[leetcode] Best Time to Buy and Sell Stock (0) | 2023.09.30 |
---|---|
[leetcode] ContainsDuplicate (1) | 2023.09.29 |
[백준] 13300 _ 방배정 (0) | 2023.09.19 |
[백준] 11726 _ 2XN 타일링 (2) | 2023.09.13 |
백준_8958_OX퀴즈 (0) | 2023.07.28 |