Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp39
- {
- class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- double moneyForGame = 20;
- double sumForDay = 0;
- int winGame = 0;
- int loseGame = 0;
- int winDay = 0;
- int loseDay = 0;
- double totalSum = 0;
- for (int i = 1; i <= days; i++)
- {
- string sport = Console.ReadLine();
- while (sport != "Finish")
- {
- string result = Console.ReadLine();
- if (result == "win")
- {
- sumForDay += moneyForGame;
- winGame++;
- }
- else if (result == "lose")
- {
- loseGame++;
- }
- sport = Console.ReadLine();
- }
- if (winGame > loseGame)
- {
- winDay++;
- sumForDay += sumForDay * 0.10;
- }
- else
- {
- loseDay++;
- }
- totalSum += sumForDay;
- sumForDay = 0;
- winGame = 0;
- loseGame = 0;
- }
- if (winDay > loseDay)
- {
- totalSum += totalSum * 0.20;
- Console.WriteLine($"You won the tournament! Total raised money: {totalSum:f2}");
- }
- else
- {
- Console.WriteLine($"You lost the tournament! Total raised money: {totalSum:f2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement