Advertisement
Guest User

ChristmasGifts

a guest
Mar 30th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace ChristmasGifts
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int days = int.Parse(Console.ReadLine());
  10.  
  11.             double money = 0.0;
  12.             int dayWon = 0;
  13.             int dayLost = 0;
  14.  
  15.             for (int i = 1; i <= days; i++){
  16.                 double dailyMoney = 0.0;
  17.                 int win = 0;
  18.                 int lose = 0;
  19.  
  20.                 while (true){
  21.                     string sport = Console.ReadLine();
  22.  
  23.                     if (sport == "Finish"){
  24.                         break;
  25.                     }
  26.  
  27.                     string result = Console.ReadLine();
  28.  
  29.                     if (result == "win"){
  30.                         win += 1;
  31.                         dailyMoney += 20;
  32.                     }
  33.                     else{
  34.                         lose += 1;
  35.                     }
  36.                 }
  37.  
  38.                 if (win > lose){
  39.                     dailyMoney *= 1.1;
  40.                     dayWon += 1;
  41.                 }
  42.                 else{
  43.                     dayLost += 1;
  44.                 }
  45.  
  46.                 money += dailyMoney;
  47.  
  48.             }
  49.  
  50.             if (dayWon > dayLost){
  51.                 Console.WriteLine($"You won the tournament! Total raised money: {money * 1.2:f2}");
  52.             }
  53.             else{
  54.                 Console.WriteLine($"You lost the tournament! Total raised money: {money:f2}");
  55.             }
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement