标签:mes using efi ima str namespace max name 产生
分析:
分两步算
一:Li表示持续i秒的期望值
**Li=(Li+1)*ai%**
二:Fi表示前i秒产生的期望幻象值
**F[i]=F[i-1]+((L[i-1]+1)^2^-(L[i-1])^2^)*ai%**
code:
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#define fo(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int maxn=1e6+2;
int n,a[maxn];
double f[maxn],L[maxn];
double sqr(double x){
return x*x;
}
int main()
{
scanf("%d",&n);
fo(i,1,n) {
scanf("%d",&a[i]);
L[i]=(L[i-1]+1)*(double)a[i]/(double)100;
f[i]=f[i-1]+(sqr(L[i-1]+1)-sqr(L[i-1]))*a[i]/(double)100;
}
printf("%.1lf",f[n]);
}
标签:mes using efi ima str namespace max name 产生
原文地址:https://www.cnblogs.com/wzxbeliever/p/11788514.html