10名评委为选手打分去掉最高分,去掉最低分,求出平均值
时间: 2024-03-19 15:42:33 浏览: 36
好的,根据您的要求,假设有10名评委为选手打分,需要去掉最高分和最低分,求出平均值。具体的计算方法如下:
1. 将所有评委的分数从高到低排序;
2. 去掉最高分和最低分,剩下的分数求和;
3. 将步骤2中得到的总分除以剩余的评委数量(即8名评委),得到平均分数。
举个例子,假设10名评委的分数如下:
评委1:90分;评委2:87分;评委3:92分;评委4:85分;评委5:89分;评委6:88分;评委7:94分;评委8:82分;评委9:91分;评委10:86分。
按照上述方法计算,去掉最高分94分和最低分82分后,剩下的8个分数为:90分、87分、92分、85分、89分、88分、91分、86分。这些分数的总和为708分,平均分数为708/8 = 88.5分。
因此,经过处理后,这10名评委给选手的平均分数是88.5分。
相关问题
10名评委为选手打分去掉最高分,去掉最低分,求出平均值用c语言写
好的,以下是用 C 语言实现求去掉最高分和最低分后的平均分数的代码:
```c
#include <stdio.h>
#include <stdlib.h>
int main() {
int scores[10]; // 存放评委打分的数组
int i, j, sum = 0; // sum 用于存放分数总和
int max, min; // max 和 min 分别用于存放最高分和最低分
// 输入10名评委的打分
for (i = 0; i < 10; i++) {
printf("请输入第%d名评委的分数:", i + 1);
scanf("%d", &scores[i]);
}
// 使用选择排序将数组从小到大排序
for (i = 0; i < 10 - 1; i++) {
for (j = i + 1; j < 10; j++) {
if (scores[i] > scores[j]) {
int temp = scores[i];
scores[i] = scores[j];
scores[j] = temp;
}
}
}
// 去掉最高分和最低分,计算平均分数
for (i = 1; i < 9; i++) {
sum += scores[i];
}
max = scores[9];
min = scores[0];
printf("去掉最高分%d分和最低分%d分后,选手的平均分数是%.2f分\n", max, min, sum / 8.0);
return 0;
}
```
这段代码使用了选择排序算法对评委打分进行排序,然后去掉最高分和最低分,计算剩余分数的平均值。最后输出去掉最高分和最低分后的平均分数。
用python,写出5位评委给选手打分,去掉最高分和最低分求平均值,多种方法
求平均值的代码如下:
方法一:
```python
scores = [8.7, 9.2, 7.8, 8.5, 9.1]
scores.remove(max(scores)) # 去掉最高分
scores.remove(min(scores)) # 去掉最低分
avg_score = sum(scores) / len(scores)
print(avg_score) # 输出平均分
```
方法二:
```python
scores = [8.7, 9.2, 7.8, 8.5, 9.1]
sorted_scores = sorted(scores)[1:-1] # 去掉最高分和最低分
avg_score = sum(sorted_scores) / len(sorted_scores)
print(avg_score) # 输出平均分
```
方法三:
```python
scores = [8.7, 9.2, 7.8, 8.5, 9.1]
max_index = scores.index(max(scores)) # 找到最高分的下标
min_index = scores.index(min(scores)) # 找到最低分的下标
scores.pop(max_index) # 去掉最高分
scores.pop(min_index) # 去掉最低分
avg_score = sum(scores) / len(scores)
print(avg_score) # 输出平均分
```
方法四:
```python
scores = [8.7, 9.2, 7.8, 8.5, 9.1]
max_score = max(scores)
min_score = min(scores)
scores_without_max_min = [score for score in scores if score != max_score and score != min_score] # 去掉最高分和最低分
avg_score = sum(scores_without_max_min) / len(scores_without_max_min)
print(avg_score) # 输出平均分
```
方法五:
```python
scores = [8.7, 9.2, 7.8, 8.5, 9.1]
scores.sort()
scores = scores[1:-1] # 去掉最高分和最低分
avg_score = sum(scores) / len(scores)
print(avg_score) # 输出平均分
```
希望能够满足您的需求,如果有任何问题,欢迎随时向我提问。