반응형
https://www.acmicpc.net/problem/2309
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> lst = new ArrayList<Integer>();
for(int i=0;i<9;i++) {
lst.add(Integer.parseInt(br.readLine()));
}
int total=0,a=0,b=0,i=0,j = 0;
for(i=0;i<9;i++) {
total+=lst.get(i);
}
for(i=0;i<8;i++) {
for(j=i+1;j<9;j++) {
if(total-lst.get(i)-lst.get(j)==100) {
a=lst.get(i);
b=lst.get(j);
break;
}
}
}
Collections.sort(lst);
for(int e : lst) {
if(e==a||e==b)
continue;
System.out.println(e);
}
}
}
728x90
반응형
'코딩테스트 > 백준' 카테고리의 다른 글
백준 2693 java 자바 (0) | 2022.08.03 |
---|---|
백준 2609 Java 자바 (0) | 2022.08.02 |
백준 10870 Java (0) | 2022.08.02 |
백준 2460 Java (0) | 2022.08.01 |
백준 2460 Java (0) | 2022.08.01 |
댓글