Guest User

ChristmasGifts

a guest
Mar 30th, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 KB | None | 0 0
  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.                     {
  35.                         lose += 1;
  36.                     }
  37.                 }
  38.                 if (win > lose){
  39.                     dailyMoney *= 1.1;
  40.                     dayWon += 1;
  41.                 }
  42.                 else
  43.                 {
  44.                     dayLost += 1;
  45.                 }
  46.                 money += dailyMoney;
  47.             }
  48.             if (dayWon > dayLost){
  49.                 Console.WriteLine($"You won the tournament! Total raised money: {money * 1.2:f2}");
  50.             }
  51.             else
  52.             {
  53.                 Console.WriteLine($"You lost the tournament! Total raised money: {money:f2}");
  54.             }
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment