Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace FootballTournament
- {
- class Program
- {
- static void Main(string[] args)
- {
- string team = Console.ReadLine();
- int match = int.Parse(Console.ReadLine());
- double w = 0;
- double d = 0;
- double l = 0;
- double counter = 0;
- for (int i = 0; i < match; i++)
- {
- if (match == 0)
- {
- break;
- }
- string result = Console.ReadLine();
- switch (result)
- {
- case "W":
- w++;
- break;
- case "D":
- d++;
- break;
- case "L":
- l++;
- break;
- }
- if (counter == match)
- {
- break;
- }
- }
- if (match == 0)
- {
- Console.WriteLine($"{team} hasn't played any games during this season.");
- }
- else
- {
- Console.WriteLine($"{team} has won {w * 3 + d:F0} points during this season.");
- Console.WriteLine("Total stats:");
- Console.WriteLine($"## W: {w}");
- Console.WriteLine($"## D: {d}");
- Console.WriteLine($"## L: {l}");
- Console.WriteLine($"Win rate: {w / match * 100:F2}%");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement