File tree 3 files changed +53
-0
lines changed
3 files changed +53
-0
lines changed Original file line number Diff line number Diff line change 16
16
| 01 | | [ Codility-Lesson1 BinaryGap] ( ./src/Iterations/BinaryGap ) | |
17
17
| 02 | | [ SWEA-1289 μμ¬μ λ©λͺ¨λ¦¬ 볡ꡬνκΈ°] ( ./src/Iterations/swea1289 ) | |
18
18
19
+ ## Recursion
20
+
21
+ | # | β | Problem | Note |
22
+ | :-: | :-: | :------------------------------------------------------- | :--- |
23
+ | 01 | | [ Baekjoon-17478 μ¬κ·ν¨μκ° λκ°μ?] ( ./src/Recursion/P17478 ) | |
24
+
19
25
## Simulation
20
26
21
27
| # | β | Problem | Note |
Original file line number Diff line number Diff line change
1
+ package Recursion .P17478 ;
2
+
3
+ import java .io .*;
4
+
5
+ public class Main {
6
+
7
+ static int N ;
8
+ static StringBuilder sb = new StringBuilder ();
9
+
10
+ public static void main (String [] args ) throws Exception {
11
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
12
+ BufferedWriter bw = new BufferedWriter (new OutputStreamWriter (System .out ));
13
+
14
+ N = Integer .parseInt (br .readLine ());
15
+
16
+ sb .append ("μ΄λ ν μ»΄ν¨ν°κ³΅νκ³Ό νμμ΄ μ λͺ
ν κ΅μλμ μ°Ύμκ° λ¬Όμλ€.\n " );
17
+ recursive (0 );
18
+ bw .write (sb .toString ());
19
+
20
+ bw .flush ();
21
+ bw .close ();
22
+ br .close ();
23
+ }
24
+
25
+ static void recursive (int cnt ) {
26
+ StringBuilder indent = new StringBuilder ();
27
+ for (int i = 0 ; i < cnt ; i ++) indent .append ("____" );
28
+
29
+ sb .append (indent ).append ("\" μ¬κ·ν¨μκ° λκ°μ?\" \n " );
30
+
31
+ if (cnt == N ) {
32
+ sb .append (indent ).append ("\" μ¬κ·ν¨μλ μκΈ° μμ μ νΈμΆνλ ν¨μλΌλ€\" \n " );
33
+ } else {
34
+ sb .append (indent ).append ("\" μ λ€μ΄λ³΄κ². μλ μλ ν μ° κΌλκΈ°μ μ΄μΈμ λͺ¨λ μ§μμ ν΅λ¬ν μ μΈμ΄ μμμ΄.\n " );
35
+ sb .append (indent ).append ("λ§μ μ¬λλ€μ λͺ¨λ κ·Έ μ μΈμκ² μλ§μ μ§λ¬Έμ νκ³ , λͺ¨λ μ§νλ‘κ² λλ΅ν΄ μ£Όμμ§.\n " );
36
+ sb .append (indent ).append ("κ·Έμ λ΅μ λλΆλΆ μ³μλ€κ³ νλ€. κ·Έλ°λ° μ΄λ λ , κ·Έ μ μΈμκ² ν μ λΉκ° μ°Ύμμμ λ¬Όμμ΄.\" \n " );
37
+ recursive (cnt + 1 );
38
+ }
39
+
40
+ sb .append (indent ).append ("λΌκ³ λ΅λ³νμμ§.\n " );
41
+ }
42
+ }
Original file line number Diff line number Diff line change
1
+ ## [ baekjoon-17478] μ¬κ·ν¨μκ° λκ°μ?
2
+
3
+ ![ image] ( https://user-images.githubusercontent.com/22045163/106705862-157f6300-6632-11eb-9ddd-1d9f5750d5e1.png )
4
+
5
+ ![ image] ( https://user-images.githubusercontent.com/22045163/106705826-06001a00-6632-11eb-91b1-bd517c846100.png )
You canβt perform that action at this time.
0 commit comments