File tree 3 files changed +45
-1
lines changed
3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 70
70
| # | ☆ | Problem | Note |
71
71
| :-: | :----: | :------------------------------------------------------------------------------------------------------------------ | :------------------------ |
72
72
| 01 | | [ Baekjoon-11050 이항 계수 1] ( https://github.com/Seogeurim/Algorithm-practice/blob/master/src/Combination/P11050 ) | |
73
- | 02 | | [ Baekjoon-11051 이항 계수 2] ( https://github.com/Seogeurim/Algorithm-practice/blob/master/src/Combination/P11051 ) | DP |
73
+ | 02 | | [ Baekjoon-11051 이항 계수 2] ( https://github.com/Seogeurim/Algorithm-practice/blob/master/src/Combination/P11051 ) | DP |
74
+ | 03 | | [ Baekjoon-1010 다리 놓기] ( https://github.com/Seogeurim/Algorithm-practice/blob/master/src/Combination/P1010 ) | |
Original file line number Diff line number Diff line change
1
+ package Combination .P1010 ;
2
+
3
+ import java .io .BufferedReader ;
4
+ import java .io .FileInputStream ;
5
+ import java .io .InputStreamReader ;
6
+ import java .util .ArrayList ;
7
+ import java .util .List ;
8
+ import java .util .StringTokenizer ;
9
+
10
+ public class Main {
11
+
12
+ static int T , N , M ;
13
+ static int combis [][];
14
+
15
+ public static void main (String [] args ) throws Exception {
16
+ System .setIn (new FileInputStream ("src/Combination/P1010/input.txt" ));
17
+
18
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
19
+ StringTokenizer st ;
20
+
21
+ T = Integer .parseInt (br .readLine ());
22
+ for (int t = 0 ; t < T ; t ++) {
23
+ st = new StringTokenizer (br .readLine ());
24
+ N = Integer .parseInt (st .nextToken ());
25
+ M = Integer .parseInt (st .nextToken ());
26
+
27
+ combis = new int [M +1 ][N +1 ];
28
+ for (int i = 1 ; i <= M ; i ++) {
29
+ for (int j = 0 ; j <= N ; j ++) {
30
+ if (j == 0 || i == j )
31
+ combis [i ][j ] = 1 ;
32
+ else combis [i ][j ] = (combis [i -1 ][j -1 ] + combis [i -1 ][j ]);
33
+ }
34
+ }
35
+
36
+ System .out .println (combis [M ][N ]);
37
+ }
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ 3
2
+ 2 2
3
+ 1 5
4
+ 13 29
You can’t perform that action at this time.
0 commit comments