Given a array of integers **A** of size **N** and an integer **B**.

Elements in array **A** represents points where we can cut the pipe, Initial length of pipe is 100 units.

For Example:- if A = [25, 35] pipe an be cut from these points only.

Find and Return the probability of any of all resulting pipe being longer than **B** meters, If the two cut locations are chosen at random from array **A**

**Note:-** As probability can be very small, return the integral part of **(probability*10^7)**.

**Input Format**

```
The first argument given is the integer array A.
The second argument given is the integer B.
```

**Output Format**

```
Return the probability of any of all resulting pipe being longer than B meters,If the two cut locations are chosen at random from array A
```

**Constraints**

```
2 <= N <= 50
1 <= A[i] <= 100
1 <= B <= 100
```

**For Example**

```
Example Input 1:
A = [25, 50, 75]
B = 25
Example Output 1:
10000000
Example Explanation 1:
Any cut will result in a pipe of greater than 25 meter
probability = 1.00000000000
probability * 10000000 = 10000000
Input 2:
A = [25, 50, 75]
B = 50
Output 2:
0
```

NOTE:You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.

Sign Up

to access hints and editorial solutions for**PipeCUTS**

to access hints and editorial solutions for

Loading...