一本通 歌手大赛

[题目分析]

首先求出6名评委的总分,然后根据去掉最高分的总分和最低分的总分,求出最高分的分值和最低分的分值,最后总分减去最高分和最低分除以4即是答案。

[参考代码]

#include <iostream>
using namespace std;
int main()
{
    float sc_all = 6 * 9.6;  //6名评委的总分
    float sc_high = 5 * 9.4;  //去掉最高分后的总分
    float sc_low = 5 * 9.8;  //去掉最低分后的总分
    float high = sc_all - sc_high;  //最高分
    float low = sc_all - sc_low;  //最低分
    float ans = ( sc_all - high - low ) / 4;  //平均分
    cout << ans << endl;
    return 0;
}

发表回复