Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ArenaTournament
- {
- class Arena
- {
- public double Discount { get; set; }
- public string Name { get; set; }
- public List<string> dayOfWeek { get; set; }
- }
- class Program
- {
- static void Main()
- {
- int numberOfPoints = int.Parse(Console.ReadLine());
- string arenaName = Console.ReadLine();
- string dayOfWeek = Console.ReadLine();
- string itemType = Console.ReadLine();
- var allArenas = new List<Arena>(3);
- GenerateArenaList(allArenas);
- var types = new Dictionary<string, int>()
- {
- { "Poor", 7000 }, { "Normal", 14000 }, { "Legendary", 21000 }
- };
- double TotalPrice = types[itemType];
- foreach (var arena in allArenas)
- {
- if (arena.Name == arenaName && arena.dayOfWeek.Contains(dayOfWeek))
- {
- TotalPrice *= (1 - arena.Discount);
- }
- }
- double itemPrice = TotalPrice / 5.0;
- if (TotalPrice > numberOfPoints)
- {
- double items = Math.Floor(numberOfPoints / itemPrice);
- double pointsLeft = numberOfPoints - items * itemPrice;
- Console.WriteLine($"Items bought: {items}");
- Console.WriteLine($"Arena points left: {pointsLeft}");
- Console.WriteLine("Failure!");
- }
- else
- {
- int items = 5;
- double pointsLeft = numberOfPoints - items * itemPrice;
- Console.WriteLine($"Items bought: {items}");
- Console.WriteLine($"Arena points left: {pointsLeft}");
- Console.WriteLine("Success!");
- }
- }
- private static void GenerateArenaList(List<Arena> allArenas)
- {
- var firstArena = new Arena
- {
- Name = "Nagrand",
- dayOfWeek = new List<string> { "Monday", "Wednesday" },
- Discount = 0.05
- };
- var secondArena = new Arena
- {
- Name = "Gurubashi",
- dayOfWeek = new List<string> { "Tuesday", "Thursday" },
- Discount = 0.1
- };
- var thirdArena = new Arena
- {
- Name = "Dire Maul",
- dayOfWeek = new List<string> { "Friday", "Saturday" },
- Discount = 0.07
- };
- allArenas.Add(firstArena);
- allArenas.Add(secondArena);
- allArenas.Add(thirdArena);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement