-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcar_tunnel.cpp
More file actions
65 lines (65 loc) · 1.64 KB
/
Copy pathcar_tunnel.cpp
File metadata and controls
65 lines (65 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define Fl(i,a,b) for(ll i=a;i<b;i++)
#define Fll(i,a,b) for(ll i=a;i<=b;i++)
#define Fr(i,a,b) for(ll i=a;i>=0;i--)
//-------------------------------------------------------
#define ipair pair<ll,ll>
#define vll vector<ll>
#define vstr vector<string>
#define vchar vector<char>
#define sll set<ll>
#define mll map<ll,ll>
//---------------------------------------------------------
#define MIN -1
#define MAX 1e10
#define VER 101
#define fastread ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
vll adj[VER];
//----------------------------------------------------------------------------
void make_edge(ll a,ll b)
{
adj[a].pb(b);
adj[b].pb(a);
}
//-----------------------------------------------------------------------------
int main()
{
ll t,c,d,s,n;
ld speed,car_one,car_two,delay;
cin>>t,n;
while(t--)
{
car_one=car_two=0;
delay=0.0;
cin>>n;
vll v(n);
Fl(i,0,n)
cin>>v[i];
cin>>c>>d>>s;
speed=(long double)(d/s);
car_two=v[0];
Fl(i,0,n-1)
{
car_one+=(ld)(v[i]);
car_one+=speed;
car_two+=(ld)(v[i]);
car_two+=speed;
if((car_two-car_one)>=v[i+1])
delay=0.0;
else
delay=v[i+1]-(car_two-car_one);
car_two+=delay;
}
car_one+=v[n-1];
car_two+=v[n-1];
cout<<setprecision(10)<<fixed<<(ld)((c-1)*(car_two-car_one));
cout<<"\n";
}
return 0;
}