Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exampreparation
- {
- class Program
- {
- static void Main(string[] args)
- {
- string team = Console.ReadLine();
- int gamesCount = int.Parse(Console.ReadLine());
- string endGame = Console.ReadLine();
- int winCount = 0;
- int drawCount = 0;
- int loseCount = 0;
- if (gamesCount == 0)
- {
- Console.WriteLine($"{team} hasn't played any games during this season.");
- return;
- }
- for (int i = 0; i < gamesCount; i++)
- {
- char game = char.Parse(endGame);
- if (game == 'W')
- {
- winCount++;
- }
- else if (game == 'D')
- {
- drawCount++;
- }
- else
- {
- loseCount++;
- }
- endGame = Console.ReadLine();
- }
- int pointsWin = winCount * 3;
- int pointsDraw = drawCount * 1;
- int fullpoints = pointsWin + pointsDraw;
- double percentWin = winCount * 1.0 / gamesCount * 100.0;
- Console.WriteLine($"{team} has won {fullpoints} points during this season.");
- Console.WriteLine("Total stats:");
- Console.WriteLine($"## W: {winCount}");
- Console.WriteLine($"## D: {drawCount}");
- Console.WriteLine($"## L: {loseCount}");
- Console.WriteLine($"Win rate: {percentWin:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement