YTU OJ 问题D:歌手的分数
要注意这里输入并不是分开输入的,也没说明,坑人!
using System;
class Program
{
static void Main(string[] args)
{
double average = 0;
string str=Console.ReadLine();
string[] str1 = str.Split(' ');//以空格为分割符分割字符串,并存入数组
int max = 0;
int min = 0x7fffffff; //int的极限值
double sum = 0;
int b;
foreach(string a in str1) //遍历数组
{
b = Convert.ToInt32(a);
if (b > max)
max = b;
if (b < min)
min = b;
sum += b;
}
average = (sum - max - min) / (str1.Length - 2);
Console.WriteLine(average);
}
}