CF309A.Morning run

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

People like to be fit. That's why many of them are ready to wake up at dawn, go to the stadium and run. In this problem your task is to help a company design a new stadium.

The city of N has a shabby old stadium. Many people like it and every morning thousands of people come out to this stadium to run. The stadium can be represented as a circle, its length is exactly ll meters with a marked start line. However, there can't be simultaneous start in the morning, so exactly at 7, each runner goes to his favorite spot on the stadium and starts running from there. Note that not everybody runs in the same manner as everybody else. Some people run in the clockwise direction, some of them run in the counter-clockwise direction. It mostly depends on the runner's mood in the morning, so you can assume that each running direction is equiprobable for each runner in any fixed morning.

The stadium is tiny and is in need of major repair, for right now there only is one running track! You can't get too playful on a single track, that's why all runners keep the same running speed — exactly 1 meter per a time unit. Nevertheless, the runners that choose different directions bump into each other as they meet.

The company wants to design a new stadium, but they first need to know how bad the old one is. For that they need the expectation of the number of bumpings by tt time units after the running has begun. Help the company count the required expectation. Note that each runner chooses a direction equiprobably, independently from the others and then all runners start running simultaneously at 7 a.m. Assume that each runner runs for tt time units without stopping. Consider the runners to bump at a certain moment if at that moment they found themselves at the same point in the stadium. A pair of runners can bump more than once.

输入格式

The first line of the input contains three integers nn , ll , tt ( 1<=n<=106,1<=l<=109,1<=t<=1091<=n<=10^{6},1<=l<=10^{9},1<=t<=10^{9} ). The next line contains nn distinct integers a1,a2,...,ana_{1},a_{2},...,a_{n} (0<=a_{1}<a_{2}<...<a_{n}<l) , here aia_{i} is the clockwise distance from the start line to the ii -th runner's starting position.

输出格式

Print a single real number — the answer to the problem with absolute or relative error of at most 10610^{-6} .

输入输出样例

  • 输入#1

    2 5 1
    0 2
    

    输出#1

    0.2500000000
    
  • 输入#2

    3 7 3
    0 1 6
    

    输出#2

    1.5000000000
    

说明/提示

There are two runners in the first example. If the first runner run clockwise direction, then in 1 time unit he will be 1m away from the start line. If the second runner run counter-clockwise direction then in 1 time unit he will be also 1m away from the start line. And it is the only possible way to meet. We assume that each running direction is equiprobable, so the answer for the example is equal to 0.50.5=0.250.5·0.5=0.25 .

首页