Advertisement
Guest User

ChristmasGifts

a guest
Mar 30th, 2020
1,424
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.                 if (win > lose){
  38.                     dailyMoney *= 1.1;
  39.                     dayWon += 1;
  40.                 }
  41.                 else{
  42.                     dayLost += 1;
  43.                 }
  44.                 money += dailyMoney;
  45.             }
  46.             if (dayWon > dayLost){
  47.                 Console.WriteLine($"You won the tournament! Total raised money: {money * 1.2:f2}");
  48.             }
  49.             else{
  50.                 Console.WriteLine($"You lost the tournament! Total raised money: {money:f2}");
  51.             }
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement