bzoj 4318OSU!

和tyvj的Easy一样吧(然而还是不会2333)

期望是不能直接平方的(涨姿势),所以,,呵呵

 1 #include<bits/stdc++.h>
 2 #define inf 0x7fffffff
 3 #define LL long long
 4 #define N 100005
 5 using namespace std;
 6 inline int ra()
 7 {
 8     int x=0,f=1; char ch=getchar();
 9     while (ch<'0' || ch>'9') {if (ch=='-') f=-1; ch=getchar();}
10     while (ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}
11     return x*f;
12 }
13 double f[N],l[N],ll[N],a[N];
14 int main()
15 {
16     int n=ra();
17     for (int i=1; i<=n; i++)
18     {
19         scanf("%lf",&a[i]);
20         l[i]=(l[i-1]+1)*a[i];
21         ll[i]=(ll[i-1]+l[i-1]*2+1)*a[i];
22         f[i]=f[i-1]+(3*l[i-1]+3*ll[i-1]+1)*a[i];
23     }
24     printf("%.1lf",f[n]);
25     return 0;
26 }

 

posted @ 2017-02-10 10:36  ws_ccd  阅读(120)  评论(0编辑  收藏  举报