Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class TheFootballStatistician
- {
- static void Main()
- {
- decimal payment = decimal.Parse(Console.ReadLine());
- int multiply = 0;
- var table = new Dictionary<string, int>();
- while (true)
- {
- string game = Console.ReadLine();
- string[] match = game.Split(new string[] { }, StringSplitOptions.RemoveEmptyEntries);
- if (game != "End of the league.")
- {
- for (int i = 0; i <= 2; i+=2)
- {
- for (int j = 1; j < match[i].Length; j++)
- {
- if (Char.IsUpper(match[i][j]))
- {
- match[i] = match[i].Insert(j, " ");
- break;
- }
- }
- }
- int result = 0;
- if (!table.ContainsKey(match[0]))
- {
- table.Add(match[0], result = match[1] == "1" ? 3 : (match[1] == "X" ? 1 : 0));
- }
- else
- {
- table[match[0]] += result = match[1] == "1" ? 3 : (match[1] == "X" ? 1 : 0);
- }
- if (!table.ContainsKey(match[2]))
- {
- table.Add(match[2], result = match[1] == "1" ? 0 : (match[1] == "X" ? 1 : 3));
- }
- else
- {
- table[match[2]] += result = match[1] == "1" ? 0 : (match[1] == "X" ? 1 : 3);
- }
- multiply++;
- }
- else
- {
- break;
- }
- }
- Console.WriteLine("{0:F2}lv.", payment * multiply * 1.94M);
- var orderedTable = table.OrderBy(x => x.Key);
- foreach (var pair in orderedTable)
- {
- Console.WriteLine("{0} - {1} points.", pair.Key, pair.Value);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement