Advertisement
fbinnzhivko

02.00 The Football Statistician

Apr 15th, 2016
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. class TheFootballStatistician
  4. {
  5.     static void Main()
  6.     {
  7.         decimal payment = decimal.Parse(Console.ReadLine());
  8.         int multiply = 0;
  9.         var table = new Dictionary<string, int>();
  10.         table.Add("Arsenal", 0);
  11.         table.Add("Chelsea", 0);
  12.         table.Add("Everton", 0);
  13.         table.Add("Liverpool", 0);
  14.         table.Add("Manchester City", 0);
  15.         table.Add("Manchester United", 0);
  16.         table.Add("Southampton", 0);
  17.         table.Add("Tottenham", 0);
  18.  
  19.         while (true)
  20.         {
  21.             string game = Console.ReadLine();
  22.             string[] match = game.Split(new string[] { }, StringSplitOptions.RemoveEmptyEntries);
  23.             if (game != "End of the league.")
  24.             {
  25.                 for (int i = 0; i <= 2; i += 2)
  26.                 {
  27.                     for (int j = 1; j < match[i].Length; j++)
  28.                     {
  29.                         if (Char.IsUpper(match[i][j]))
  30.                         {
  31.                             match[i] = match[i].Insert(j, " ");
  32.                             break;
  33.                         }
  34.                     }
  35.                 }
  36.  
  37.                 int gameResult = 0;
  38.                 table[match[0]] += gameResult = match[1] == "1" ? 3 : (match[1] == "X" ? 1 : 0);
  39.                 table[match[2]] += gameResult = match[1] == "1" ? 0 : (match[1] == "X" ? 1 : 3);
  40.                 multiply++;
  41.             }
  42.             else
  43.             {
  44.                 break;
  45.             }
  46.         }
  47.  
  48.         Console.WriteLine("{0:F2}lv.", payment * multiply * 1.94M);
  49.         foreach (var pair in table)
  50.         {
  51.             Console.WriteLine("{0} - {1} points.", pair.Key, pair.Value);
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement