-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFly.cpp
More file actions
38 lines (37 loc) · 807 Bytes
/
Fly.cpp
File metadata and controls
38 lines (37 loc) · 807 Bytes
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
#include <bits/stdc++.h>
#define for_n(i, a, n) for (ll i = a; i < n; i++)
#define ll long long
#define v(t) vector<t>
using namespace std;
int main(){
ll n, m;
cin >> n >> m;
v(ll) a,b;
for_n(i, 0, n){
ll x;
cin >> x;
if(x <= 1){
cout << -1 << endl;
return 0;
}
a.push_back(x);
}
for_n(i, 0, n){
ll x;
cin >> x;
if(x <= 1){
cout << -1 << endl;
return 0;
}
b.push_back(x);
}
double s = m;
s += s / (a[0] - 1);
for(ll i = n-1; i >= 1; i--){
s += s / (a[i] - 1);
s += s / (b[i] - 1);
}
s += s / (b[0] - 1);
cout << setprecision(10) << fixed << s - m << endl;
return 0;
}