Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- int tournaments = int.Parse(Console.ReadLine());
- double totalCharity = 0.0;
- int totalWin = 0;
- int totalLoses = 0;
- for (int i = 0; i < tournaments; i++)
- {
- int winCount = 0;
- int loseCount = 0;
- double charity = 0.0;
- string sport = Console.ReadLine();
- while (sport != "Finish")
- {
- string command = Console.ReadLine();
- if (command == "win")
- {
- charity += 20;
- winCount++;
- totalWin++;
- }
- else
- {
- loseCount++;
- totalLoses++;
- }
- sport = Console.ReadLine();
- }
- if (winCount > loseCount)
- {
- charity *= 1.10;
- }
- totalCharity += charity;
- }
- if (totalWin > totalLoses)
- {
- totalCharity *= 1.20;
- Console.WriteLine($"You won the tournament! Total raised money: {totalCharity:f2}");
- }
- else
- {
- Console.WriteLine($"You lost the tournament! Total raised money: {totalCharity:f2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement