File tree 3 files changed +92
-0
lines changed
3 files changed +92
-0
lines changed Original file line number Diff line number Diff line change
1
+ package jeonghyun .week18 ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class bj_5717 {
6
+
7
+ // 백준 5717 - 상근이의 친구들
8
+ public static void main (String [] args ) {
9
+
10
+ Scanner sc = new Scanner (System .in );
11
+
12
+ while (true ) {
13
+ int a = sc .nextInt ();
14
+ int b = sc .nextInt ();
15
+
16
+ if (a == 0 && b == 0 )
17
+ break ;
18
+
19
+ System .out .println (a + b );
20
+ }
21
+
22
+ sc .close ();
23
+
24
+ }
25
+
26
+ }
Original file line number Diff line number Diff line change
1
+ package jeonghyun .week18 ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class bj_5988 {
6
+
7
+ // 백준 5988 - 홀수일까 짝수일까
8
+ public static void main (String [] args ) {
9
+
10
+ Scanner sc = new Scanner (System .in );
11
+
12
+ int T = sc .nextInt ();
13
+
14
+ while (T != 0 ) {
15
+ String [] str = sc .next ().split ("" );
16
+
17
+ int num = Integer .parseInt (str [str .length - 1 ]);
18
+
19
+ if (num % 2 == 0 ) {
20
+ System .out .println ("even" );
21
+ } else {
22
+ System .out .println ("odd" );
23
+ }
24
+
25
+ T --;
26
+ }
27
+
28
+
29
+
30
+
31
+ }
32
+
33
+ }
Original file line number Diff line number Diff line change
1
+ package jeonghyun .week18 ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class bj_9095 {
6
+
7
+ // 백준 9095 - 1,2,3 더하기
8
+
9
+ static int dp [] = new int [11 ];
10
+
11
+ public static void main (String [] args ) {
12
+
13
+ Scanner sc = new Scanner (System .in );
14
+
15
+ int t = sc .nextInt ();
16
+
17
+ dp [1 ] = 1 ; // 초기화
18
+ dp [2 ] = 2 ;
19
+ dp [3 ] = 4 ;
20
+
21
+ for (int j =4 ;j <=10 ;j ++) { // 4부터 반복
22
+ dp [j ] = dp [j -3 ] + dp [j -2 ] + dp [j -1 ]; // 점화식
23
+ }
24
+
25
+ for (int i =0 ;i <t ;i ++) {
26
+ int n = sc .nextInt ();
27
+
28
+ System .out .println (dp [n ]);
29
+ }
30
+
31
+ }
32
+
33
+ }
You can’t perform that action at this time.
0 commit comments