300561: CF107B. Basketball Team
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Basketball Team
题意翻译
### 题面背景 作为德国开罗一所大学(简称 GUC )的一名学生,瓦法同时也是一名篮球运动员。当听到 GUC 终于入围了一年一度的篮球比赛 (简称 ABC )时,他十分高兴。 ### 题面描述 一个篮球队由 $n$ 名 GUC 的球员组成,但是团队中可能有来自不同学系的学生。 GUC 有 $m$ 个学系,编号从 $1$ 到 $m$ ,瓦法的学系编号为 $h$ 。对于学系 $i$, 已知 $s_i$ ,意思是学系 $i$ 中,有多少个打篮球的学生。 瓦法有特殊能力,使他一定能在篮球队中占一席之地。但是由于他讨厌浮点数,所以他需要你帮助他计算篮球队中至少有一个队友与他同一个学系的可能性。 **注意:我们认为每一个包含瓦法的团队出现的概率相同,每个学生彼此不同。** ### 输入格式 第一行包含三个整数 $n, m, h$。 $n$ 表示篮球队的人数, $m$ 表示 GUC 的学系数, $h$ 表示瓦法所在的学系的编号。 第二行包含 $m$ 个以空格隔开的整数 $s_i$,意思是学系 $i$ 中打篮球的学生数。 **注意: $s_h$ 中包含了瓦法。** ### 输出格式 输出篮球队中至少有一个队友与瓦法同一个学系的可能性。 如果 GUC 没有足够的选手参加 ABC ,输出 ```-1``` 。只要你的答案与标准答案相差小于 $10^{-6}$ ,就可以 AC 。 ### 输入输出样例 #### 输入 #1 ``` 3 2 1 2 1 ``` #### 输出 #1 ``` 1 ``` #### 输入 #2 ``` 3 2 1 1 1 ``` #### 输出 #2 ``` -1 ``` #### 输入 #3 ``` 3 2 1 2 2 ``` #### 输出 #3 ``` 0.666667 ``` ### 样例说明 #### 样例1 3个选手(两个来自学系1,一个来自学系2)必须被选中,即与瓦法来自同一个学系的选手会被选中,所以一定有一个队员与他来自同一个学系。 #### 样例2 选手不足 #### 样例3 篮球队选中瓦法的情况一共有 3 种,其中 2 种中有与瓦法来自同一个学系的队员。 ### 数据范围 $ 1 \leqslant n \leqslant 100 $ $ 1 \leqslant m \leqslant 1000 $ $ 1 \leqslant h \leqslant m $ $ 1 \leqslant s_i \leqslant 100$题目描述
As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC). A team is to be formed of $ n $ players, all of which are GUC students. However, the team might have players belonging to different departments. There are $ m $ departments in GUC, numbered from $ 1 $ to $ m $ . Herr Wafa's department has number $ h $ . For each department $ i $ , Herr Wafa knows number $ s_{i} $ — how many students who play basketball belong to this department. Herr Wafa was also able to guarantee a spot on the team, using his special powers. But since he hates floating-point numbers, he needs your help at finding the probability that he will have at least one teammate belonging to his department. Note that every possible team containing Herr Wafa is equally probable. Consider all the students different from each other.输入输出格式
输入格式
The first line contains three integers $ n $ , $ m $ and $ h $ ( $ 1<=n<=100,1<=m<=1000,1<=h<=m $ ) — the number of players on the team, the number of departments in GUC and Herr Wafa's department, correspondingly. The second line contains a single-space-separated list of $ m $ integers $ s_{i} $ ( $ 1<=s_{i}<=100 $ ), denoting the number of students in the $ i $ -th department. Note that $ s_{h} $ includes Herr Wafa.
输出格式
Print the probability that Herr Wafa will have at least one teammate from his department. If there is not enough basketball players in GUC to participate in ABC, print -1. The answer will be accepted if it has absolute or relative error not exceeding $ 10^{-6} $ .
输入输出样例
输入样例 #1
3 2 1
2 1
输出样例 #1
1
输入样例 #2
3 2 1
1 1
输出样例 #2
-1
输入样例 #3
3 2 1
2 2
输出样例 #3
0.666667