zoukankan      html  css  js  c++  java
  • 评委会打分

    青年歌手大奖赛_评委会打分

    Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)
    Total Submission(s) : 92   Accepted Submission(s) : 51

    Font: Times New Roman | Verdana | Georgia

    Font Size:

    Problem Description

    青年歌手大奖赛中,评委会给参赛选手打分。选手得分规则为去掉一个最高分和一个最低分,然后计算平均得分,请编程输出某选手的得分。

    Input

    输入数据有多组,每组占一行,每行的第一个数是n(2<n<=100),表示评委的人数,然后是n个评委的打分。

    Output

    对于每组输入数据,输出选手的得分,结果保留2位小数,每组输出占一行。

    Sample Input

    3 99 98 97
    4 100 99 98 97
    

    Sample Output

    98.00
    98.50
    
    代码示例
    #include<stdio.h>
    #include<algorithm>
    using namespace std;
    int main()
    {
     int a[101],n,i;
     float m,j;
     while(scanf("%d",&n)!=EOF)
     {
      m=0;
      for(i=0;i<n;i++)
      scanf("%d",&a[i]);
      sort(a,a+n);
      for(i=1;i<n-1;i++)
      m+=a[i];
      j=m/(n-2);
      printf("%.2f
    ",j);
     }
     return 0;
    }
  • 相关阅读:
    javaScript对象
    javaScript基础
    使用javaScript和JQuery制作经典面试题:光棒效果
    Animate自定义动画
    使用jQuery快速高效制作网页交互特效
    jQuery中绑定事件bind() on() live() one()的异同
    小笔记1(Get请求)

    this关键字
    Eclipse断点调试(下)
  • 原文地址:https://www.cnblogs.com/playboy307/p/5273862.html
Copyright © 2011-2022 走看看