CF261B.Maxim and Restaurant

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is pp meters.

Maxim has got a dinner party tonight, nn guests will come to him. Let's index the guests of Maxim's restaurant from 1 to nn . Maxim knows the sizes of all guests that are going to come to him. The ii -th guest's size ( aia_{i} ) represents the number of meters the guest is going to take up if he sits at the restaurant table.

Long before the dinner, the guests line up in a queue in front of the restaurant in some order. Then Maxim lets the guests in, one by one. Maxim stops letting the guests in when there is no place at the restaurant table for another guest in the queue. There is no place at the restaurant table for another guest in the queue, if the sum of sizes of all guests in the restaurant plus the size of this guest from the queue is larger than pp . In this case, not to offend the guest who has no place at the table, Maxim doesn't let any other guest in the restaurant, even if one of the following guests in the queue would have fit in at the table.

Maxim is now wondering, what is the average number of visitors who have come to the restaurant for all possible n!n! orders of guests in the queue. Help Maxim, calculate this number.

输入格式

The first line contains integer nn (1<=n<=50)(1<=n<=50) — the number of guests in the restaurant. The next line contains integers a1a_{1} , a2a_{2} , ...... , ana_{n} (1<=ai<=50)(1<=a_{i}<=50) — the guests' sizes in meters. The third line contains integer pp (1<=p<=50)(1<=p<=50) — the table's length in meters.

The numbers in the lines are separated by single spaces.

输出格式

In a single line print a real number — the answer to the problem. The answer will be considered correct, if the absolute or relative error doesn't exceed 10410^{-4} .

输入输出样例

  • 输入#1

    3
    1 2 3
    3
    

    输出#1

    1.3333333333
    

说明/提示

In the first sample the people will come in the following orders:

  • (1,2,3)(1,2,3) — there will be two people in the restaurant;
  • (1,3,2)(1,3,2) — there will be one person in the restaurant;
  • (2,1,3)(2,1,3) — there will be two people in the restaurant;
  • (2,3,1)(2,3,1) — there will be one person in the restaurant;
  • (3,1,2)(3,1,2) — there will be one person in the restaurant;
  • (3,2,1)(3,2,1) — there will be one person in the restaurant.

In total we get (2+1+2+1+1+1)/6(2+1+2+1+1+1)/6 = 8/68/6 = 1.(3)1.(3) .

首页