http://acm.hdu.edu.cn/showproblem.php?pid=2086
#include <bits/stdc++.h> using namespace std; double c,a0,ann; int main() { int n; while(~scanf("%d", &n)) { scanf("%lf%lf", &a0, &ann); int sum = 0; for(int i = 1; i <= n; i++) { scanf("%lf", &c); sum+=c*(n + 1 - i); } printf("%.2f\n",(a0 * n + ann - 2 * sum) / (n + 1)); } return 0; }
原文:https://www.cnblogs.com/zlrrrr/p/9380178.html