# UVA 10883 - Supermean（组合数学+数值优化）

### 题目链接:10883 - Supermean

1     2      3      4      5

1.5  2.5   3.5   4.5

2       3      4

2.5   3.5

3

log(C(n - 1, i) * a[i] / 2^(n - 1)) = log(C(n - 1, i)) + log(a[i]) - (n - 1) * log(2)；

```#include <stdio.h>
#include <string.h>
#include <math.h>
#define min(a,b) ((a)<(b)?(a):(b))
const int N = 50005;
int t, n;
double a, c;

double cal(int i, double a) {
return c + log(a) - (n - 1) * log(2);
}

int main() {
int cas = 0;
scanf("%d", &t);
while (t--) {
scanf("%d", &n);
double sum = 0;
c = 0;
for (int i = 0; i < n; i++) {
scanf("%lf", &a);
if (a < 0) sum -= exp(cal(i, -a));
else sum += exp(cal(i, a));
c = c + log(n - i - 1) - log(i + 1);
}
printf("Case #%d: %.3lf\n", ++cas, sum);
}
return 0;
}```

UVA 10883 - Supermean（组合数学+数值优化）,布布扣,bubuko.com

## UVA - 10883 Supermean

Description Problem F Supermean Time Limit: 2 second "I have not failed. I've just found 10,000 ways that won't work." Thomas Edison Do you know how to compute the mean (or average) of n numbers? Well, that's not good enough for me. I want the s

## UVA 11609 Teams 组合数学+快速幂

In a galaxy far far away there is an ancient game played among the planets. The specialty of the gameis that there is no limitation on the number of players in each team, as long as there is a captain inthe team. (The game is totally strategic, so so

## python科学计算_scipy_常数与优化

scipy在numpy的基础上提供了众多的数学.科学以及工程计算中常用的模块:是强大的数值计算库: 1. 常数和特殊函数 scipy的constants模块包含了众多的物理常数: import scipy.constants as CC.c ?#真空中的光速C.h ?#普朗克常数C.pi #圆周率? 在C.physical_constants字典中,通过物理常数的名称访问该物理常数,如: C.physical_constants['speed of light in vacuum'] (2997