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