题解 | #不自然的序列#
不自然的序列
https://www.nowcoder.com/practice/2a78404ad81e4e3e8741a620ce506f8c
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n + 1), b(n + 1); for (int i = 1; i <= n; i++ ) cin >> a[i]; for (int i = 1; i <= n; i++ ) cin >> b[i]; int pos = n; for( ; pos >= 0; pos--) if(a[pos] != b[pos]) break; int q; double ret(1.0); cin >> q; while(q--){ int r; double p; cin >> r >> p; if(r >= pos) ret *= 1-p; } printf("%.8f\n",1-ret); return 0; }