zoukankan      html  css  js  c++  java
  • HDU-2014

    评委评分,去除最高最低分,算平均分,平均分的处理需要乘1.0,使得运算以双精度浮点数进行计算

     1 #include<stdio.h>
     2 #include<stdlib.h>
     3 #include<math.h>
     4 #include<string.h>
     5 int main()
     6 {
     7     int n;
     8     int i,j;
     9     int s[200];
    10     int m,M,mp,Mp;
    11     double ave;
    12     while(scanf("%d",&n)!=EOF)
    13     {
    14         m=100000;
    15         M=-100000;
    16         memset(s,0,sizeof(s));
    17         for (i=1;i<=n;i++)
    18         {
    19             j=0;
    20             scanf("%d",&s[i]);
    21             if (s[i]>M) 
    22             {
    23                 M=s[i];
    24                 Mp=i;
    25             }
    26             if (s[i]<m)
    27             {
    28                 m=s[i];
    29                 mp=i;
    30             }
    31         }
    32         s[mp]=0; s[Mp]=0;
    33         for (i=1;i<=n;i++)
    34             j+=s[i];
    35         ave=1.0*j/(n-2);
    36         printf("%.2lf
    ",ave);
    37     }
    38     return 0;
    39 }
  • 相关阅读:
    python
    spice-vdagent
    no ia32-libs
    git conflict
    wget mirror
    docker !veth
    libprotobuff8.so not found
    angular 列表渲染机制
    Java测试技巧
    react组件生命周期
  • 原文地址:https://www.cnblogs.com/leiyuxiang/p/3489853.html
Copyright © 2011-2022 走看看