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