Advertisement
tsvetelinapasheva

ChristmasTournament

Feb 25th, 2021
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.76 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp39
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             int days = int.Parse(Console.ReadLine());
  11.             double moneyForGame = 20;
  12.             double sumForDay = 0;
  13.             int winGame = 0;
  14.             int loseGame = 0;
  15.             int winDay = 0;
  16.             int loseDay = 0;
  17.             double totalSum = 0;
  18.             for (int i = 1; i <= days; i++)
  19.             {
  20.                 string sport = Console.ReadLine();
  21.                 while (sport != "Finish")
  22.                 {
  23.                     string result = Console.ReadLine();
  24.                     if (result == "win")
  25.                     {
  26.                         sumForDay += moneyForGame;
  27.                         winGame++;
  28.                     }
  29.                     else if (result == "lose")
  30.                     {
  31.                         loseGame++;
  32.                     }
  33.  
  34.                     sport = Console.ReadLine();
  35.                 }
  36.                 if (winGame > loseGame)
  37.                 {
  38.                     winDay++;
  39.                     sumForDay += sumForDay * 0.10;
  40.                 }
  41.                 else
  42.                 {
  43.                     loseDay++;
  44.                 }
  45.                 totalSum += sumForDay;
  46.                 sumForDay = 0;
  47.                 winGame = 0;
  48.                 loseGame = 0;
  49.             }
  50.             if (winDay > loseDay)
  51.             {
  52.                 totalSum += totalSum * 0.20;
  53.                 Console.WriteLine($"You won the tournament! Total raised money: {totalSum:f2}");
  54.             }
  55.             else
  56.             {
  57.                 Console.WriteLine($"You lost the tournament! Total raised money: {totalSum:f2}");
  58.             }
  59.  
  60.  
  61.         }
  62.     }
  63. }
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement