This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
Integer[] arr = new Integer[9]; | |
boolean check = false; | |
int sum =0; | |
for(int i=0; i<9; i++) { | |
int a = sc.nextInt(); | |
arr[i] = a; | |
sum +=a; | |
} | |
for(int i=0; i<9; i++) { | |
if(check) break; | |
for(int j=0; j<9; j++) { | |
if(i==j) { | |
continue; | |
} | |
if(sum-arr[i]-arr[j]==100) { | |
arr[i]=0; | |
arr[j]=0; | |
check = true; | |
break; | |
} | |
} | |
} | |
Arrays.sort(arr); | |
for(int i=0; i<9; i++) { | |
if(arr[i]!=0) { | |
System.out.println(arr[i]); | |
} | |
} | |
} | |
} |
'백준 알고리즘 > JAVA' 카테고리의 다른 글
자바 백준 1065번 한수 (0) | 2018.08.23 |
---|---|
자바 백준 2231번 분해합 (0) | 2018.08.23 |
자바 백준 3653번 영화 수집 (0) | 2018.08.14 |
자바 백준 9375번 패션왕 신해빈 (0) | 2018.08.13 |
자바 백준 7785번 회사에 있는 사람 (0) | 2018.08.11 |