0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

P1654 OSU!

R52364321
This commit is contained in:
Baoshuo Ren 2021-07-04 11:17:24 +08:00 committed by Baoshuo Ren
parent bc7231084a
commit 6975e0bf42
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,21 @@
#include <bits/stdc++.h>
using namespace std;
int n;
double a[100005], l1[100005], l2[100005], l3[100005], ans[100005];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
l1[i] = a[i] * (l1[i - 1] + 1);
l2[i] = a[i] * (l2[i - 1] + 2 * l1[i - 1] + 1);
l3[i] = a[i] * (l3[i - 1] + 3 * l2[i - 1] + 3 * l1[i - 1] + 1);
ans[i] = ans[i - 1] + l3[i] - a[i] * l3[i - 1];
}
cout << fixed << setprecision(1) << ans[n] << endl;
return 0;
}