Daten

03. Arena Tournament

Mar 12th, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.71 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.  
  7. namespace Arena_Tournament
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var points = double.Parse(Console.ReadLine());
  14.             string arena = Console.ReadLine().ToLower();
  15.             string day = Console.ReadLine().ToLower();
  16.             string items = Console.ReadLine().ToLower();
  17.  
  18.             double itemsCondition = 0;
  19.             double discount = 0.0;
  20.  
  21.             if (items == "poor")
  22.             {
  23.                 itemsCondition = 7000;
  24.             }
  25.             else if (items == "normal")
  26.             {
  27.                 itemsCondition = 14000;
  28.             }
  29.             else if (items == "legendary")
  30.             {
  31.                 itemsCondition = 21000;
  32.             }
  33.  
  34.             if (arena == "nagrand")
  35.             {
  36.                 if (day == "monday" || day == "wednesday")
  37.                 {
  38.                     discount = 0.05;
  39.                 }
  40.                 else
  41.                 {
  42.                     discount = 0;
  43.                 }
  44.             }
  45.  
  46.             else if (arena == "gurubashi")
  47.             {
  48.                 if (day == "tuesday" || day == "thursday")
  49.                 {
  50.                     discount = 0.10;
  51.                 }
  52.                 else
  53.                 {
  54.                     discount = 0;
  55.                 }
  56.             }
  57.  
  58.             else if (arena == "dire maul")
  59.             {
  60.                 if (day == "friday" || day == "saturday")
  61.                 {
  62.                     discount = 0.07;
  63.                 }
  64.                 else
  65.                 {
  66.                     discount = 0;
  67.                 }
  68.             }
  69.  
  70.             double priceItems = itemsCondition - (itemsCondition * discount);
  71.             double pricePerItem = priceItems / 5;
  72.  
  73.             if(priceItems <= points)
  74.             {
  75.                 double pointsLeft = points - priceItems;
  76.                 Console.WriteLine("Items bought: 5");
  77.                 Console.WriteLine("Arena points left: {0}", pointsLeft);
  78.                 Console.WriteLine("Success!");
  79.             }
  80.  
  81.             else
  82.             {
  83.                 double itemsBought = 0;
  84.  
  85.                 while (pricePerItem <= points)
  86.                 {
  87.                     itemsBought++;
  88.                     points -= pricePerItem;
  89.                 }
  90.  
  91.                 double pointsLeft = points - (itemsBought * pricePerItem);
  92.                 Console.WriteLine("Items bought: {0}", itemsBought);
  93.                 Console.WriteLine("Arena points left: {0}", points);
  94.                 Console.WriteLine("Failure!");
  95.             }
  96.         }
  97.     }
  98. }
Add Comment
Please, Sign In to add comment