Advertisement
Guest User

ArenaTournament PB2018MARCH VK

a guest
Mar 12th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Globalization;
  7.  
  8. namespace zadacha3
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             double points = double.Parse(Console.ReadLine());
  15.             string arenaName = Console.ReadLine().ToLower();
  16.             string day = Console.ReadLine().ToLower();
  17.             string itemCondition = Console.ReadLine().ToLower();
  18.  
  19.             var itemsPrice = 0.0;
  20.             var otstupka = 0.0;
  21.  
  22.             switch (arenaName)
  23.             {
  24.                 case "nagrand":
  25.                     {
  26.                         if (day == "monday" || day == "wednesday")
  27.                         {
  28.                             otstupka = 0.05;
  29.                         }
  30.                     } break;
  31.  
  32.                 case "gurubashi":
  33.                     {
  34.                         if (day == "tuesday" || day == "thursday")
  35.                         {
  36.                             otstupka = 0.10;
  37.                         }
  38.                     } break;
  39.  
  40.                 case "dire maul":
  41.                     {
  42.                         if (day == "friday" || day == "saturday")
  43.                         {
  44.                             otstupka = 0.07;
  45.                         }
  46.  
  47.                     } break;
  48.             }
  49.  
  50.             switch (itemCondition)
  51.             {
  52.                 case "poor":
  53.                     {
  54.                         itemsPrice = 7000.00;
  55.                     } break;
  56.  
  57.                 case "normal":
  58.                     {
  59.                         itemsPrice = 14000.00;
  60.                     } break;
  61.  
  62.                 case "legendary":
  63.                     {
  64.                         itemsPrice = 21000.00;
  65.                     } break;
  66.             }
  67.  
  68.             int counter = 0;
  69.             int counter2 = 0;
  70.             var calcItemsTax = itemsPrice - (itemsPrice * otstupka);
  71.             var calcItem = calcItemsTax / 5;
  72.             var calcItem2 = 0.0;
  73.  
  74.             for (int i = 1; i <= 5; i++)
  75.             {
  76.                 if (points >= calcItem)
  77.                 {
  78.                     calcItem2 = points - calcItem;
  79.                     points = points - calcItem;
  80.                     counter++;
  81.                     counter2 = i;
  82.                     //Console.WriteLine(points);
  83.                 }
  84.             }
  85.  
  86.             if (counter2 == 5)
  87.             {
  88.                 Console.WriteLine($"Items bought: {counter2}");
  89.                 Console.WriteLine($"Arena points left: {points}");
  90.                 Console.WriteLine("Success!");
  91.             }
  92.  
  93.             else if (counter2 < 5)
  94.             {
  95.                 Console.WriteLine($"Items bought: {counter2}");
  96.                 Console.WriteLine($"Arena points left: {points}");
  97.                 Console.WriteLine("Failure!");
  98.             }
  99.         }
  100.     }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement