Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _06._Basketball_Tournament
- {
- class Program
- {
- static void Main(string[] args)
- {
- int dessiWins = 0;
- int dessiLosts = 0;
- int totalMathes = 0;
- while (true)
- {
- string command = Console.ReadLine();
- if (command == "End of tournaments")
- {
- break;
- }
- string tourName = command;
- int matchesCount = int.Parse(Console.ReadLine());
- for (int i = 1; i <= matchesCount; i++)
- {
- int dessiScore = int.Parse(Console.ReadLine());
- int opponentScore = int.Parse(Console.ReadLine());
- if (dessiScore > opponentScore)
- {
- dessiWins++;
- int diff = dessiScore - opponentScore;
- Console.WriteLine($"Game {i} of tournament {tourName}: win with {diff} points.");
- }
- else if (dessiScore < opponentScore)
- {
- dessiLosts++;
- int diff = opponentScore - dessiScore;
- Console.WriteLine($"Game {i} of tournament {tourName}: lost with {diff} points.");
- }
- }
- totalMathes += matchesCount;
- }
- double winsPercent = dessiWins / (totalMathes * 1.0) * 100;
- double lostsPercent = dessiLosts / (totalMathes * 1.0) * 100;
- Console.WriteLine($"{winsPercent:f2}% matches win");
- Console.WriteLine($"{lostsPercent:f2}% matches lost");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement