PS:推算。。。数组如果开得不够大也会超时。。。
代码:
#include "stdio.h"double cal(int t,double a[]);int main(){ double a0,an1,c[1100],sum,k; int i,n,b; while(~scanf("%d",&n)){ scanf("%lf%lf",&a0,&an1); for(i=1;i<=n;i++) scanf("%lf",&c[i]); sum=(double)n/(double)(n+1)*a0+1.0/(n+1)*an1; k=(double)n*2.0; for(i=1;i<=n;i++){ sum-=k/(n+1)*c[i]; k-=2.0; } printf("%.2lf\n",sum); } return 0;}