Advertisement
nevenailievaa

06.TournamentOfChristmas

Nov 8th, 2022
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.25 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06.TournamentOfChristmas
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //INPUT
  10.             int daysInput = int.Parse(Console.ReadLine());
  11.  
  12.             //CHANGEABLE-INPUT
  13.             string gameName = null;
  14.  
  15.             string gameStatus;
  16.  
  17.             double allWonGamesMoney = 0;
  18.             double dayWonGamesMoney = 0;
  19.  
  20.             int timesWon = 0;
  21.             int timesWonDay = 0;
  22.  
  23.             int timesLost = 0;
  24.             int timesLostDay = 0;
  25.  
  26.             bool wonTournir = false;
  27.  
  28.             //FOR-CONSTRUCTION
  29.             for (int i = 1; i <= daysInput; i++)
  30.             {
  31.                 gameName = Console.ReadLine();
  32.                
  33.                 //WHILE-CONSTRUCTION
  34.                 while (gameName != "Finish")
  35.                 {
  36.                     gameStatus = Console.ReadLine();
  37.  
  38.                     if (gameStatus == "win")
  39.                     {
  40.                         allWonGamesMoney += 20;
  41.                         dayWonGamesMoney += 20;
  42.  
  43.                         timesWon++;
  44.                         timesWonDay++;
  45.                     }
  46.                     if (gameStatus == "lose")
  47.                     {
  48.                         timesLost++;
  49.                         timesLostDay++;
  50.                     }
  51.  
  52.                     gameName = Console.ReadLine();
  53.                 }
  54.                
  55.                 //FOR-CONSTRUCTION-CONTINUE
  56.                 if (timesWonDay > timesLostDay)
  57.                 {
  58.                     allWonGamesMoney += (dayWonGamesMoney * 0.1);
  59.                 }
  60.  
  61.                 timesWonDay = 0;
  62.                 timesLostDay = 0;
  63.                 dayWonGamesMoney = 0;
  64.  
  65.             }
  66.  
  67.             //OUTPUT
  68.             if (timesWon > timesLost)
  69.             {
  70.                 allWonGamesMoney += (allWonGamesMoney * 0.2);
  71.                 wonTournir = true;
  72.             }
  73.  
  74.             if (wonTournir)
  75.             {
  76.                 Console.WriteLine($"You won the tournament! Total raised money: {allWonGamesMoney:f2}");
  77.             }
  78.             else
  79.             {
  80.                 Console.WriteLine($"You lost the tournament! Total raised money: {allWonGamesMoney:f2}");
  81.             }
  82.         }
  83.     }
  84. }
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement