Example
input
5
3 4 2
1 4 5
1 5 1
3
4 6 6
1 2 3 4
2 1 200000
1 200000
2 4 3
9 11
output
11
2.5
34.5
199999.9999975
11.333333
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
ll t,n,d,h,a[N];
int main(){
scanf("%lld",&t);
while(t--){
scanf("%lld%lld%lld",&n,&d,&h);
for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
sort(a+1,a+n+1);
double sum=n*h*d/2.0;
ll k=a[1]+h;
for(int i=2;i<=n;i++){
if(a[i]<k) sum-=pow((k-a[i]),2)*d/(2.0*h);
k=a[i]+h;
}
printf("%lf\n",sum);
}
return 0;
}