青年歌手大奖赛_评委会打分
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 45985 Accepted Submission(s): 23025
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
Author
lcy
第一次代码:
#include <stdio.h>
int main ()
{
int n,i;
double sum,max,min,score;
while (scanf ("%d",&n)!=EOF)
{
sum=max=0;
min=101;
for (i=0;i<n;i++)
{
scanf ("%lf",&score);
if (score>max)
{
sum+=max;
max=score;
printf ("max:%lf\n",max);
}
else if (score<min)
{
sum+=min;
min=score;
printf ("min:%lf\n",min);
}
else sum+=score;
}
printf ("%.2lf\n",(sum-101)/(n-2.0));
}
return 0;
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
11170120 | 2014-07-24 16:52:04 | Wrong Answer | 2014 | 0MS | 240K | 663 B | C++ | Hidden Secret |
第二次代码:
#include <stdio.h>
int main ()
{
int n,i;
double sum,max,min,score;
while (scanf ("%d",&n)!=EOF)
{
sum=max=0;
min=101;
for (i=0;i<n;i++)
{
scanf ("%lf",&score);
sum+=score;
if (score>max) max=score;
else if (score<min) min=score;
}
sum=sum-max-min;
n=n-2;
printf ("%.2lf\n",sum/n);
}
return 0;
}
Run ID | Submit Time | Judge Status | Pro.ID | Exe.Time | Exe.Memory | Code Len. | Language | Author |
11170501 | 2014-07-24 17:05:56 | Accepted | 2014 | 0MS | 240K | 455 B | C++ | Hidden Secret |
结论:其实我也不知道怎么A对的……