fork download
  1. using MathNet.Numerics.Statistics;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Linq;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. string[] sampledata = { "項目名1", "1", "項目名2", "2", "項目名3", "3", "項目名10", "10", "項目名1", "1.1", };
  11.  
  12. Dictionary<string, List<double>> dict = new Dictionary<string, List<double>>();
  13. string title = "";
  14. bool first = false;
  15.  
  16. foreach (string str in sampledata)
  17. {
  18. first = !first;
  19.  
  20. if (first)
  21. {
  22. title = str;
  23. continue;
  24. }
  25.  
  26. if (!dict.ContainsKey(title))
  27. {
  28. dict.Add(title, new List<double>());
  29. }
  30.  
  31. dict[title].Add(double.Parse(str));
  32. }
  33.  
  34. foreach (KeyValuePair<string, List<double>> pair in dict)
  35. {
  36. Debug.WriteLine("名前 :" + pair.Key);
  37. Debug.WriteLine("平均 :" + pair.Value.Average());
  38. Debug.WriteLine("最大 :" + pair.Value.Max());
  39. Debug.WriteLine("最小 :" + pair.Value.Min());
  40. Debug.WriteLine("標準偏差:" + pair.Value.StandardDeviation());
  41. }
  42. }
  43. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(1,7): error CS0246: The type or namespace name `MathNet' could not be found. Are you missing an assembly reference?
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty