Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace LegendaryFarming
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> Input = Console.ReadLine().Split(" ").Select(x=>x.ToLower()).ToList();
- Dictionary <string, int> LegendaryItem = new Dictionary<string, int>();
- SortedDictionary<string, string> MaterialItem = new SortedDictionary<string, string>();
- MaterialItem.Add("shards", "Shadowmourne");
- MaterialItem.Add("fragments", "Valanyr");
- MaterialItem.Add("motes", "Dragonwrath");
- Dictionary<string, int> Crap = new Dictionary<string, int>();
- int count = 1;
- LegendaryItem.Add("shards", 0);
- LegendaryItem.Add("fragments", 0);
- LegendaryItem.Add("motes", 0);
- bool isWinner = false;
- string winner = String.Empty;
- while (count <= Input.Count && !isWinner)
- {
- if (count % 2 != 0)
- {
- //quantity
- if (LegendaryItem.ContainsKey(Input[count]))
- {
- LegendaryItem[Input[count]] += int.Parse(Input[count - 1]);
- }
- else
- {
- if (Crap.ContainsKey(Input[count]))
- {
- Crap[Input[count]] += int.Parse(Input[count - 1]);
- }
- else
- {
- Crap.Add(Input[count], int.Parse(Input[count - 1]));
- }
- }
- }
- for (int i = 0; i < LegendaryItem.Count; i++)
- {
- if (LegendaryItem.ElementAt(i).Value >= 250)
- {
- int tempValue = LegendaryItem.ElementAt(i).Value - 250;
- string tempKey = LegendaryItem.ElementAt(i).Key;
- winner = LegendaryItem.ElementAt(i).Key;
- LegendaryItem[tempKey] = tempValue;
- isWinner = true;
- break;
- }
- }
- count++;
- }
- LegendaryItem=LegendaryItem.OrderByDescending(x => x.Value).ThenBy(x => x.Key).ToDictionary(x=>x.Key, x=>x.Value);
- Crap = Crap.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value);
- if (isWinner)
- {
- Console.WriteLine($"{MaterialItem[winner]} obtained!");
- }
- foreach (var item in LegendaryItem)
- {
- Console.WriteLine($"{item.Key}: {item.Value}");
- }
- foreach (var item in Crap)
- {
- Console.WriteLine($"{item.Key}: {item.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement