Advertisement
Guest User

Untitled

a guest
Oct 12th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. class TheFootballStatistician
  6. {
  7. static void Main()
  8. {
  9. decimal payment = decimal.Parse(Console.ReadLine());
  10. int multiply = 0;
  11. var table = new Dictionary<string, int>();
  12.  
  13. while (true)
  14. {
  15. string game = Console.ReadLine();
  16. string[] match = game.Split(new string[] { }, StringSplitOptions.RemoveEmptyEntries);
  17. if (game != "End of the league.")
  18. {
  19. for (int i = 0; i <= 2; i+=2)
  20. {
  21. for (int j = 1; j < match[i].Length; j++)
  22. {
  23. if (Char.IsUpper(match[i][j]))
  24. {
  25. match[i] = match[i].Insert(j, " ");
  26. break;
  27. }
  28. }
  29. }
  30.  
  31. int result = 0;
  32. if (!table.ContainsKey(match[0]))
  33. {
  34. table.Add(match[0], result = match[1] == "1" ? 3 : (match[1] == "X" ? 1 : 0));
  35. }
  36. else
  37. {
  38. table[match[0]] += result = match[1] == "1" ? 3 : (match[1] == "X" ? 1 : 0);
  39. }
  40.  
  41. if (!table.ContainsKey(match[2]))
  42. {
  43. table.Add(match[2], result = match[1] == "1" ? 0 : (match[1] == "X" ? 1 : 3));
  44. }
  45. else
  46. {
  47. table[match[2]] += result = match[1] == "1" ? 0 : (match[1] == "X" ? 1 : 3);
  48. }
  49.  
  50. multiply++;
  51. }
  52. else
  53. {
  54. break;
  55. }
  56. }
  57.  
  58. Console.WriteLine("{0:F2}lv.", payment * multiply * 1.94M);
  59. var orderedTable = table.OrderBy(x => x.Key);
  60. foreach (var pair in orderedTable)
  61. {
  62. Console.WriteLine("{0} - {1} points.", pair.Key, pair.Value);
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement