Codeforces Beta Round 28(Codeforces 格式)
C
浴室排队
Bath Queue
Codeforces
2200
原题
← BD →

浴室排队AI (CI翻译)

There are $*n*$ students living in the campus. Every morning all students wake up at the same time and go to wash. There are $*m*$ rooms with wash basins. The $*i*$-th of these rooms contains $*a*_{*i*}$ wash basins. Every student independently select one the rooms with equal probability and goes to it. After all students selected their rooms, students in each room divide into queues by the number of wash basins so that the size of the largest queue is the least possible. Calculate the expected value of the size of the largest queue among all rooms.

校园里住着 $*n*$ 名学生。每天早上,所有学生同时起床去洗漱。校园里有 $*m*$ 个带洗脸盆的房间,第 $*i*$ 个房间有 $*a*_{*i*}$ 个洗脸盆。每名学生独立地以相同概率选择一个房间并前往。所有学生选好房间后,每个房间里的学生会根据洗脸盆的数量分成若干队,使最长队伍的长度尽可能小。请计算所有房间中最长队伍长度的期望值。AI (CI翻译)

Input

输入格式

AI (CI翻译)

The first line contains two positive integers $*n*$ and $*m*$ ($1 ≤ *n*, *m* ≤ 50$) — the amount of students and the amount of rooms. The second line contains $*m*$ integers $*a*_{1}, *a*_{2}, ... , *a*_{*m*}$ ($1 ≤ *a*_{*i*} ≤ 50$). $*a*_{*i*}$ means the amount of wash basins in the $*i*$-th room.

第一行包含两个正整数 $*n*$ 和 $*m*$($1 ≤ *n*, *m* ≤ 50$),分别表示学生人数和房间数。第二行包含 $*m*$ 个整数 $*a*_{1}, *a*_{2}, ... , *a*_{*m*}$($1 ≤ *a*_{*i*} ≤ 50$)。$*a*_{*i*}$ 表示第 $*i*$ 个房间中洗脸盆的数量。AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output single number: the expected value of the size of the largest queue. Your answer must have an absolute or relative error less than $10^{ - 9}$.

输出一个数:最长队伍长度的期望值。答案的绝对误差或相对误差必须小于 $10^{ - 9}$。AI (CI翻译)

样例

Input #1
1 1
2
Output #1
1.00000000000000000000
InputCopy OutputCopy
Input #2
2 2
1 1
Output #2
1.50000000000000000000
InputCopy OutputCopy
Input #3
2 3
1 1 1
Output #3
1.33333333333333350000
InputCopy OutputCopy
Input #4
7 5
1 1 2 3 1
Output #4
2.50216960000000070000
InputCopy OutputCopy
题目信息
题号
28C
时间限制
2 s
内存限制
256 MB
标签
组合数学
动态规划
概率论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。