2364. Hopeless Coach

单点时限: 2.0 sec

内存限制: 256 MB

One of the Premier League (Persian Gulf Cup) teams had very bad results this year. The board is under pressure to fire the coach, but the coach is considered hero by some fans and it is not easy to fire him. The board decides to give him a last chance; they talked to media that they can only support the coach if the team gets at least 11 points in the next 5 matches. The coach wants to know the probability of passing their condition and ask you to help him. You can assume that the probability of having a win/draw/loss in a future match can be determined from the results of the matches the team currently has played. For example, if the team has already played 10 matches and has won three of them, the probability of having a win in any of the next five matches is 30%. The same rule applies to draws or losses.

You also know the team results (a win earns 3 points and a draw earns 1). There are 18 teams in the league and each team play against each of the other teams twice.

输入格式

There are multiple test cases in the input. The first line of each test case contains two numbers N and P. N is the number of matches and P is the points that are required in the next N games. This is followed by three numbers W, D and L (the number of wins, draws and losses in the previous games). The last line of the input contains two zero numbers.

输出格式

For each test case, you should print the percentage probability of getting at least P points in the next N matches with exactly one digit after decimal point.

样例

Input
5 11
3 5 4
2 3
5 0 5
3 5
5 5 4
1 1
1 1 1
0 0
Output
4.3
75.0
42.8
66.7

17 人解决,31 人已尝试。

23 份提交通过,共有 116 份提交。

6.0 EMB 奖励。

创建: 11 年,4 月前.

修改: 2 年,4 月前.

最后提交: 2 月,1 周前.

来源: Tehran 2007-2008

题目标签