## 11181 - Probability|Given

Moderator: Board moderators

KirllButin
New poster
Posts: 6
Joined: Mon Feb 26, 2007 10:42 pm

### 11181 - Probability|Given

I broke my head, but didn't invent nothing

sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Contact:
for each person i:

jurajz
Learning poster
Posts: 69
Joined: Sat Sep 02, 2006 7:30 pm
Location: Slovakia
For example - first test case...

3 people, 2 of this person buy something.

There are only C(3,2) = 3 possibilities:

a) 1 & 2 buy something, 3 not, probability of this is 0,1*0,2*0,7 = 0,014
b) 1 & 3 buy something, 2 not, probability of this is 0,1*0,8*0,3 = 0,024
c) 2 & 3 buy something, 1 not, probability of this is 0,9*0,2*0,3 = 0,054

The total probability of this three events is 0,014 + 0,024 + 0,054 = 0,092.

Let's determine probability, that person 1 buy something. This is true in cases a) and b). Also (0,014+0,024)/0,092 = 0,413043478

For person 2 -> in cases a) and c) person 2 buy something. Also (0,014+0,054)/0,092 = 0,739130434

For person 3 -> in cases b) and c) person 3 buy something. Also (0,024+0,054)/0,092 = 0,847826087

Hope it helps

KirllButin
New poster
Posts: 6
Joined: Mon Feb 26, 2007 10:42 pm
Thank you very much!
I understand it

StatujaLeha
Learning poster
Posts: 91
Joined: Tue May 31, 2005 2:01 pm
Location: Russia
Hello all. Give me please output for this input:
See post below.
Last edited by StatujaLeha on Fri Mar 02, 2007 8:49 pm, edited 2 times in total.

jurajz
Learning poster
Posts: 69
Joined: Sat Sep 02, 2006 7:30 pm
Location: Slovakia
Hello!

Your input is very huge. I tried paste here output, but then it happened something like in the last post in this thread:

http://online-judge.uva.es/board/viewtopic.php?t=4210

Also the window of the message was broken and hard to read. Also, I made output only for first 59 cases of your output.

Then, the input is:

2 1
0.5
0.99
5 3
0.62
0.84
0.45
0.75
0.71
8 2
0.35
0.72
0.67
0.46
0.91
0.34
0.42
0.73
13 7
0.96
0.18
0.15
0.57
0.46
0.21
0.28
0.79
0.32
0.27
0.29
0.35
0.94
4 3
0.13
0.43
0.84
0.31
12 5
0.87
0.24
0.92
0.97
0.67
0.89
0.93
0.31
0.89
0.68
0.86
0.75
11 5
0.56
0.5
0.42
0.14
0.68
0.96
0.55
0.6
0.79
0.8
0.6
7 1
0.48
0.19
0.33
0.64
0.74
0.46
0.6
7 6
0.38
0.34
0.49
0.66
0.83
0.57
0.38
19 12
0.81
0.73
0.75
0.59
0.58
0.34
0.4
0.37
0.66
0.93
0.76
0.81
0.45
0.24
0.92
0.7
0.79
0.57
0.13
18 6
0.7
0.81
0.16
0.45
0.27
0.85
0.14
0.81
0.92
0.9
0.8
0.31
0.44
0.26
0.2
0.67
0.51
0.17
18 14
0.43
0.43
0.15
0.99
0.89
0.48
0.21
0.58
0.42
0.26
0.66
0.8
0.43
0.18
0.1
0.21
0.52
0.45
11 1
0.27
0.48
0.13
0.65
0.91
0.12
0.6
0.41
0.66
0.24
0.5
17 0
0.79
0.58
0.14
0.11
0.64
0.63
0.29
0.58
0.48
0.7
0.18
0.47
0.27
0.48
0.53
0.88
0.83
8 5
0.57
0.53
0.74
0.99
0.66
0.45
0.91
0.9
10 9
0.38
0.73
0.24
0.38
0.94
0.39
0.59
0.42
0.55
0.65
14 8
0.67
0.74
0.63
0.78
0.1
0.58
0.58
0.7
0.96
0.48
0.81
0.69
0.18
0.29
18 6
0.98
0.62
0.18
0.69
0.2
0.57
0.48
0.81
0.25
0.38
0.86
0.91
0.12
0.34
0.72
0.85
0.88
0.66
3 3
0.93
0.89
0.82
5 2
0.58
0.72
0.31
0.41
0.39
18 0
0.99
0.45
0.12
0.9
0.9
0.43
0.59
0.51
0.28
0.91
0.79
0.55
0.53
0.62
0.65
0.72
0.35
0.98
7 2
0.32
0.72
0.39
0.94
0.81
0.99
0.96
10 8
0.15
0.35
0.24
0.89
0.71
0.72
0.95
0.7
0.38
0.73
20 4
0.86
0.47
0.29
0.59
0.77
0.76
0.89
0.23
0.75
0.67
0.86
0.36
0.95
0.18
0.92
0.45
0.94
0.34
0.11
0.96
12 3
0.93
0.65
0.55
0.83
0.22
0.18
0.42
0.75
0.93
0.46
0.71
0.38
7 4
0.14
0.76
0.72
0.29
0.11
0.55
0.3
14 8
0.69
0.22
0.79
0.73
0.54
0.64
0.9
0.75
0.49
0.56
0.43
0.74
0.42
0.18
19 16
0.58
0.21
0.42
0.35
0.27
0.14
0.54
0.94
0.94
0.54
0.82
0.99
0.53
0.9
0.27
0.47
0.58
0.87
0.53
11 3
0.12
0.45
0.52
0.3
0.63
0.77
0.42
0.59
0.27
0.25
0.23
5 3
0.21
0.61
0.53
0.82
0.55
14 4
0.42
0.62
0.42
0.66
0.24
0.8
0.27
0.9
0.13
0.24
0.6
0.2
0.65
0.63
12 8
0.87
0.95
0.5
0.6
0.24
0.95
0.34
0.39
0.65
0.36
0.14
0.78
3 1
0.98
0.13
0.11
5 3
0.69
0.32
0.2
0.97
0.2
7 2
0.5
0.75
0.46
0.87
0.83
0.88
0.64
10 2
0.55
0.77
0.67
0.84
0.25
0.77
0.59
0.78
0.53
0.9
3 2
0.36
0.57
0.41
16 13
0.8
0.92
0.26
0.9
0.86
0.41
0.91
0.31
0.87
0.13
0.2
0.1
0.84
0.48
0.83
0.9
12 3
0.4
0.83
0.68
0.38
0.95
0.57
0.57
0.4
0.58
0.59
0.63
0.8
18 3
0.78
0.63
0.47
0.11
0.9
0.7
0.28
0.43
0.34
0.65
0.7
0.71
0.94
0.65
0.56
0.52
0.2
0.23
6 0
0.16
0.97
0.76
0.47
0.97
0.61
10 1
0.72
0.17
0.42
0.37
0.76
0.75
0.21
0.43
0.19
0.29
6 1
0.76
0.75
0.93
0.52
0.84
0.44
15 8
0.69
0.42
0.93
0.97
0.63
0.21
0.35
0.87
0.88
0.95
0.78
0.73
0.12
0.94
0.41
2 2
0.15
0.81
11 9
0.95
0.23
0.1
0.38
0.59
0.31
0.53
0.54
0.27
0.84
0.76
14 13
0.42
0.28
0.51
0.4
0.23
0.91
0.65
0.25
0.12
0.42
0.81
0.17
0.94
0.18
13 9
0.83
0.6
0.53
0.75
0.12
0.48
0.8
0.37
0.92
0.42
0.15
0.39
0.81
1 1
0.2
18 15
0.35
0.13
0.64
0.31
0.2
0.94
0.18
0.75
0.39
0.42
0.55
0.74
0.41
0.73
0.59
0.25
0.98
0.52
18 17
0.11
0.47
0.87
0.31
0.39
0.2
0.13
0.24
0.91
0.57
0.65
0.53
0.33
0.62
0.94
0.31
0.92
0.19
11 7
0.44
0.95
0.76
0.28
0.5
0.87
0.97
0.34
0.63
0.81
0.83
7 4
0.41
0.49
0.7
0.24
0.82
0.69
0.43
12 8
0.62
0.4
0.15
0.35
0.19
0.43
0.92
0.48
0.97
0.94
0.68
0.11
5 4
0.45
0.12
0.96
0.58
0.69
3 3
0.39
0.24
0.85
1 0
0.68
11 10
0.82
0.92
0.72
0.77
0.5
0.73
0.31
0.13
0.33
0.27
0.9
10 6
0.38
0.43
0.67
0.28
0.73
0.47
0.99
0.13
0.19
0.11
0 0
And my AC program gives:
Case 1:
0.010000
0.990000
Case 2:
0.517605
0.820689
0.310090
0.703601
0.648015
Case 3:
0.075093
0.321235
0.261489
0.116889
0.718136
0.071928
0.100026
0.335203
Case 4:
0.980218
0.253920
0.212055
0.713420
0.604971
0.295327
0.389397
0.882599
0.441017
0.376223
0.402468
0.478471
0.969914
Case 5:
0.358616
0.872958
0.981745
0.786681
Case 6:
0.491679
0.036282
0.640262
0.844936
0.205284
0.545263
0.676278
0.051099
0.545263
0.213378
0.467472
0.282804
Case 7:
0.374298
0.313729
0.242903
0.062824
0.516433
0.934912
0.363730
0.418531
0.669644
0.684464
0.418531
Case 8:
0.107011
0.027193
0.057099
0.206096
0.329952
0.098754
0.173894
Case 9:
0.788642
0.748536
0.865171
0.933266
0.973467
0.902275
0.788642
Case 10:
0.839312
0.764359
0.783494
0.623652
0.613200
0.354038
0.419524
0.386765
0.695406
0.943631
0.792963
0.839312
0.474027
0.245911
0.935312
0.735176
0.820974
0.602704
0.130239
Case 11:
0.432318
0.596721
0.051626
0.196920
0.096844
0.668680
0.044360
0.596721
0.811209
0.768314
0.579787
0.115869
0.190244
0.092323
0.066984
0.395212
0.240509
0.055360
Case 12:
0.829355
0.829355
0.499825
0.998526
0.982164
0.857328
0.611339
0.901334
0.823147
0.681295
0.928397
0.964358
0.829355
0.559991
0.375185
0.611339
0.876579
0.841127
Case 13:
0.019468
0.048586
0.007865
0.097750
0.532196
0.007177
0.078952
0.036577
0.102173
0.016621
0.052635
Case 14:
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
Case 15:
0.418390
0.371889
0.646540
0.987302
0.535103
0.289050
0.882590
0.869135
Case 16:
0.862432
0.968815
0.732999
0.862432
0.994618
0.868121
0.941407
0.883563
0.931014
0.954599
Case 17:
0.661255
0.738120
0.616659
0.781077
0.079431
0.560623
0.560623
0.694422
0.962592
0.449406
0.812734
0.683399
0.148378
0.251282
Case 18:
0.930273
0.260470
0.042187
0.330082
0.047847
0.220036
0.161456
0.501461
0.063079
0.111702
0.600447
0.720578
0.026506
0.095124
0.365790
0.579066
0.645777
0.298118
Case 19:
1.000000
1.000000
1.000000
Case 20:
0.516490
0.698838
0.203982
0.300848
0.279841
Case 21:
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
Case 22:
0.012680
0.068293
0.017208
0.378255
0.111893
0.869091
0.542578
Case 23:
0.362141
0.696456
0.537808
0.976937
0.925337
0.928811
0.990129
0.921774
0.728408
0.932200
Case 24:
0.283324
0.049464
0.023190
0.078650
0.170648
0.162479
0.348686
0.017028
0.154862
0.108582
0.283324
0.031754
0.581099
0.012550
0.442010
0.045753
0.528140
0.029132
0.007092
0.642232
Case 25:
0.702519
0.194524
0.133085
0.423904
0.032512
0.025398
0.081271
0.292858
0.702519
0.094868
0.247288
0.069252
Case 26:
0.236240
0.910952
0.891422
0.487939
0.184979
0.784610
0.503858
Case 27:
0.694252
0.194289
0.799198
0.736834
0.530089
0.640115
0.907977
0.757837
0.475002
0.552173
0.409605
0.747361
0.398823
0.156444
Case 28:
0.895426
0.587513
0.812147
0.758099
0.673928
0.450077
0.878403
0.990214
0.990214
0.878403
0.966816
0.998444
0.873817
0.983038
0.673928
0.843022
0.895426
0.977267
0.873817
Case 29:
0.053624
0.275429
0.343161
0.157720
0.468280
0.655992
0.249083
0.420183
0.137946
0.125359
0.113222
Case 30:
0.194589
0.696407
0.597230
0.888069
0.623705
Case 31:
0.185627
0.356530
0.185627
0.402378
0.087138
0.602846
0.101064
0.786002
0.042498
0.087138
0.335310
0.069814
0.390474
0.367556
Case 32:
0.935628
0.976732
0.655481
0.749554
0.336957
0.976732
0.470175
0.532483
0.790786
0.495515
0.197244
0.882713
Case 33:
0.994459
0.003033
0.002508
Case 34:
0.879533
0.524225
0.302438
0.991366
0.302438
Case 35:
0.095129
0.262125
0.081525
0.488944
0.390967
0.517553
0.163757
Case 36:
0.091452
0.232401
0.147743
0.339049
0.025695
0.232401
0.106880
0.244338
0.084647
0.495394
Case 37:
0.552331
0.810035
0.637634
Case 38:
0.960058
0.985909
0.638332
0.982033
0.973794
0.792825
0.983990
0.701116
0.975917
0.392030
0.541305
0.315026
0.969410
0.839072
0.967148
0.982033
Case 39:
0.084732
0.455217
0.243149
0.078197
0.793327
0.160720
0.160720
0.084732
0.166768
0.173055
0.200900
0.398483
Case 40:
0.273372
0.144790
0.078724
0.011420
0.520212
0.191897
0.035437
0.067438
0.046633
0.156638
0.191897
0.200125
0.668588
0.156638
0.110713
0.095183
0.022947
0.027348
Case 41:
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
Case 42:
0.215768
0.017186
0.060762
0.049280
0.265714
0.251729
0.022305
0.063300
0.019683
0.034273
Case 43:
0.119176
0.112903
0.500000
0.040771
0.197581
0.029570
Case 44:
0.494523
0.220438
0.872896
0.944936
0.419711
0.089971
0.171018
0.768556
0.785590
0.908700
0.623055
0.549322
0.047594
0.890741
0.212949
Case 45:
1.000000
1.000000
Case 46:
0.993791
0.664613
0.373047
0.821428
0.920429
0.763533
0.899377
0.903181
0.719738
0.977671
0.963194
Case 47:
0.956641
0.919262
0.969833
0.952903
0.894884
0.996895
0.983093
0.905805
0.769746
0.956641
0.992635
0.846703
0.997996
0.856964
Case 48:
0.926338
0.783743
0.726014
0.883524
0.199536
0.679429
0.910996
0.559033
0.967887
0.616934
0.247532
0.582834
0.916201
Case 49:
1.000000
Case 50:
0.798898
0.487648
0.932998
0.765440
0.629891
0.992114
0.595089
0.959622
0.826931
0.845120
0.904356
0.957495
0.839296
0.955316
0.918026
0.701365
0.997471
0.892923
Case 51:
0.790273
0.970770
0.996127
0.942304
0.959456
0.896315
0.826527
0.917916
0.997436
0.980445
0.986042
0.977013
0.947372
0.984113
0.998345
0.942304
0.997746
0.889494
Case 52:
0.364175
0.950115
0.741677
0.207532
0.430742
0.865876
0.970325
0.262673
0.585865
0.799248
0.821771
Case 53:
0.424615
0.523413
0.758590
0.228075
0.867468
0.748672
0.449168
Case 54:
0.821385
0.629354
0.269569
0.569942
0.336482
0.661780
0.972008
0.710904
0.989938
0.979362
0.859129
0.200149
Case 55:
0.874909
0.249452
0.995736
0.925886
0.954018
Case 56:
1.000000
1.000000
1.000000
Case 57:
0.000000
Case 58:
0.986389
0.994608
0.975886
0.981478
0.937993
0.977066
0.861984
0.585029
0.874107
0.832351
0.993110
Case 59:
0.614256
0.669330
0.857480
0.482140
0.890589
0.708688
0.996812
0.237723
0.340781
0.202202
Hope it helps
Last edited by jurajz on Fri Mar 02, 2007 7:40 pm, edited 1 time in total.

jurajz
Learning poster
Posts: 69
Joined: Sat Sep 02, 2006 7:30 pm
Location: Slovakia
Bad luck, it seems, that after long post all others (short of long) posts views in broken window...

StatujaLeha
Learning poster
Posts: 91
Joined: Tue May 31, 2005 2:01 pm
Location: Russia
jurajz wrote:Hello!

Your input is very huge. I tried paste here output, but then it happened something like in the last post in this thread:

Hope it helps
Thanks a lot, my output the same, but I still get WA. Is there any tricky cases? Also, can you post a code that prints output?

StatujaLeha
Learning poster
Posts: 91
Joined: Tue May 31, 2005 2:01 pm
Location: Russia
Heh, got AC