Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Numerics;
- using System.Linq;
- namespace Football_Tournament
- {
- class FootballTournament
- {
- static void Main()
- {
- string teamName = Console.ReadLine();
- int playedGames = int.Parse(Console.ReadLine());
- int wonGames = 0;
- int drawGames = 0;
- int lostGames = 0;
- if (playedGames > 0)
- {
- for (int i = 1; i <= playedGames; i++)
- {
- string gameResult = Console.ReadLine();
- if (gameResult == "W") wonGames++;
- else if (gameResult == "D") drawGames++;
- else if (gameResult == "L") lostGames++;
- }
- int totalWonPoints = wonGames * 3 + drawGames;
- Console.WriteLine($"{teamName} has won {totalWonPoints} points during this season.");
- Console.WriteLine("Total stats:");
- Console.WriteLine($"## W: {wonGames}");
- Console.WriteLine($"## D: {drawGames}");
- Console.WriteLine($"## L: {lostGames}");
- Console.WriteLine($"Win rate: {wonGames / (playedGames * 0.01):F2}%");
- }
- else
- {
- Console.WriteLine($"{teamName} hasn't played any games during this season.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement