mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 18:52:02 +00:00
P1654 OSU!
R52364321
This commit is contained in:
parent
bc7231084a
commit
6975e0bf42
21
Luogu/problem/P1654/P1654.cpp
Normal file
21
Luogu/problem/P1654/P1654.cpp
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user