Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace P05_FootballTournament
- {
- class P05_FootballTournament
- {
- static void Main(string[] args)
- {
- string teamName = Console.ReadLine();
- int gamesCount = int.Parse(Console.ReadLine());
- int totalPoints = 0;
- int totalWins = 0;
- int totalDraws = 0;
- for (int i = 0; i < gamesCount; i++)
- {
- string gameType = Console.ReadLine();
- if ("W" == gameType)
- {
- totalPoints += 3;
- totalWins++;
- }
- else if ("D" == gameType)
- {
- totalPoints += 1;
- totalDraws++;
- }
- }
- if (gamesCount == 0)
- {
- Console.WriteLine($"{teamName} hasn't played any games during this season.");
- }
- else
- {
- double winRate = totalWins * 1.0 / gamesCount * 100;
- Console.WriteLine($"{teamName} has won {totalPoints} points during this season.");
- Console.WriteLine("Total stats:");
- Console.WriteLine($"## W: {totalWins}");
- Console.WriteLine($"## D: {totalDraws}");
- Console.WriteLine($"## L: {gamesCount - totalWins - totalDraws}");
- Console.WriteLine($"Win rate: {winRate:F2}%");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement