简单数据统计
Time Limit:1000MS Memory Limit:65536K
Total Submit:254 Accepted:170
Description
输入若干个整数求出他们的最小值,最大值,平均值(保留三位有效数字)输入保证这些数都不超过1000的正整数
Input
输入若干个整数
Output
求出他们的最小值,最大值,平均值(保留三位有效数字)
Sample Input
2 8 3 5 1 7 3 6
Sample Output
1 8 4.375
Source
lrj程序入门
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace AK1112 {
class Program {
static void Main(string[] args) {
string[] s = Regex.Split(Console.In.ReadToEnd().Trim(), @"\s+");//what's a fuck!!!
int[] a = new int[1005];
int max = int.Parse(s[0]), min = int.Parse(s[0]);
int sum = int.Parse(s[0]);
for (int i = 1; i < s.Length; i++) {
a[i] = int.Parse(s[i]);
if (a[i] > max) max = a[i];
if (a[i] < min) min = a[i];
sum += a[i];
}
double jt = sum * 1.0 / s.Length;
Console.WriteLine("{0} {1} {2}", min, max, jt.ToString("0.000"));
//Console.ReadKey();
}
}
}