File tree Expand file tree Collapse file tree 4 files changed +45
-0
lines changed Expand file tree Collapse file tree 4 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 61
61
| 01 | | [ Programmers 소수 찾기] ( ./src/BruteForce/prg42839 ) | |
62
62
| 02 | | [ Programmers 카펫] ( ./src/BruteForce/prg42842 ) | |
63
63
| 03 | | [ Baekjoon-2961 도영이가 만든 맛있는 음식] ( ./src/BruteForce/P2961 ) | |
64
+ | 04 | | [ Baekjoon-3040 백설 공주와 일곱 난쟁이] ( ./src/BruteForce/P3040 ) | |
64
65
65
66
## DFS & BFS
66
67
Original file line number Diff line number Diff line change
1
+ package BruteForce .P3040 ;
2
+
3
+ import java .io .*;
4
+
5
+ public class Main {
6
+
7
+ static int sum = -100 ;
8
+ static int [] nums = new int [9 ];
9
+
10
+ public static void main (String [] args ) throws Exception {
11
+ System .setIn (new FileInputStream ("src/BruteForce/P3040/input.txt" ));
12
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
13
+
14
+ for (int i = 0 ; i < 9 ; i ++) {
15
+ nums [i ] = Integer .parseInt (br .readLine ());
16
+ sum += nums [i ];
17
+ }
18
+
19
+ for (int i = 0 ; i < 8 ; i ++) {
20
+ for (int j = i +1 ; j < 9 ; j ++) {
21
+ if (nums [i ] + nums [j ] == sum ) {
22
+ for (int k = 0 ; k < 9 ; k ++) {
23
+ if (k != i && k != j ) System .out .println (nums [k ]);
24
+ }
25
+ break ;
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
Original file line number Diff line number Diff line change
1
+ ## [ baekjoon-3040] 백설 공주와 일곱 난쟁이
2
+
3
+ ![ image] ( https://user-images.githubusercontent.com/22045163/107954886-656e0a80-6fe0-11eb-8204-e4e24320f9f4.png )
4
+
5
+ ![ image] ( https://user-images.githubusercontent.com/22045163/107954897-6d2daf00-6fe0-11eb-9c1d-af0e6a7c671e.png )
Original file line number Diff line number Diff line change
1
+ 8
2
+ 6
3
+ 5
4
+ 1
5
+ 37
6
+ 30
7
+ 28
8
+ 22
9
+ 36
You can’t perform that action at this time.
0 commit comments