UVa 10014 - Simple calculations
2013-07-08 17:48
183 查看
/* 推导出公式: a1 = (an+1 + n*a0 - 2Sn)/(n+1), 其中Sn = T1 + T2 + .. + Tn, Tn = c1 + .. + cn */ #include <cstdio> #include <cmath> int main() { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif int T; scanf("%d", &T); while(T--) { int n; double a, b; scanf("%d%lf%lf", &n, &a, &b); double s = 0, t = 0, c; for(int i=0; i<n; i++) { scanf("%lf", &c); t += c; s += t; } s = (b + n*a - 2*s)/(n+1); printf("%.2lf\n", s); if(T) printf("\n"); } return 0; }
相关文章推荐
- UVA 10014 Simple calculations
- uva 10014 Simple calculations
- UVA - 10014 - Simple calculations (经典的数学推导题!!)
- uva 10014 Simple calculations(公式推导)
- UVA 10014 Simple calculations
- uva 10014
- UVa 10014 - Simple calculations
- uva 10014 - Simple calculations
- uva 10014 Simple calculations
- UVA - 10014 Simple calculations
- UVA 10014(暑假-数学(3) -F - Simple calculations)
- UVA 10014(推公式)
- UVA 10014 - Simple calculations(数学)
- uva 10014 - Simple calculations
- uva 10014(数学)
- Uva 10014
- UVa 10014 - Simple calculations
- UVA10014-简单计算
- UVA 10014 简单计算
- UVA 10014 Simple calculations