Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Exam30August2015
- {
- class TheFootballStatistician
- {
- static Dictionary<string, int> teams = new Dictionary<string, int>
- {
- {"Arsenal",0 },
- {"Chelsea",0 },
- {"Everton",0 },
- {"Liverpool",0 },
- {"ManchesterCity",0 },
- {"ManchesterUnited",0 },
- {"Southampton",0 },
- {"Tottenham",0 },
- };
- static void Main()
- {
- decimal payment = decimal.Parse(Console.ReadLine());
- string input = Console.ReadLine();
- int count = 0;
- while (input != "End of the league.")
- {
- string[] matches = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- string result = matches[1];
- string team1 = matches[0];
- string team2 = matches[2];
- CalculatePoints(result, team1, team2);
- count++;
- input = Console.ReadLine();
- }
- Console.WriteLine("{0}lv.", Math.Round(payment * count * 1.94m, 2));
- foreach (var team in teams)
- {
- if (team.Key== "ManchesterCity")
- {
- Console.WriteLine("Manchester City - {0} points.", team.Value);
- }
- else if (team.Key == "ManchesterUnited")
- {
- Console.WriteLine("Manchester United - {0} points.", team.Value);
- }
- else
- {
- Console.WriteLine("{0} - {1} points.", team.Key, team.Value);
- }
- }
- }
- private static void CalculatePoints(string result,string team1, string team2)
- {
- switch (result)
- {
- case "1":
- teams[team1] += 3;
- break;
- case "2":
- teams[team2] += 3;
- break;
- case "X":
- teams[team1] ++;
- teams[team2] ++;
- break;
- default:
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement