fork download
  1. using System.Linq;
  2.  
  3. public class Test
  4. {
  5. float[]N(float[][]s){return s.Select(l=>l.Select((v,i)=>v*s[i].Sum()).Sum()).ToArray();}
  6.  
  7. public static void Main()
  8. {
  9. var scoreTable = new[]
  10. {
  11. new [] {0, 1, 0.5f, 1, 0},
  12. new [] {0, 0, 1, 0.5f, 0},
  13. new [] {0.5f, 0, 0, 0.5f, 0.5f},
  14. new [] {0, 0.5f, 0.5f, 0, 1},
  15. new [] {1, 1, 0.5f, 0, 0}
  16. };
  17.  
  18. var neustadlScores = new Test().N(scoreTable);
  19.  
  20. foreach (var neustadlScore in neustadlScores)
  21. {
  22. System.Console.WriteLine(neustadlScore);
  23. }
  24. }
  25. }
Success #stdin #stdout 0.04s 34016KB
stdin
Standard input is empty
stdout
4.25
2.5
3.5
4
4.75