Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class LegendaryFarming
- {
- static void Main()
- {
- Dictionary<string, long> keyMaterials = new Dictionary<string, long>();
- keyMaterials["shards"] = 0;
- keyMaterials["motes"] = 0;
- keyMaterials["fragments"] = 0;
- SortedDictionary<string, long> junkMaterials = new SortedDictionary<string, long>();
- bool isInput = true;
- while (isInput)
- {
- string[] materials = Console.ReadLine().ToLower().Split(' ').ToArray();
- for (int i = 0; i < materials.Length; i++)
- {
- long curentQuantiti = long.Parse(materials[i]);
- string curentMaterial = materials[i + 1];
- if (curentMaterial == "shards" || curentMaterial == "motes" || curentMaterial == "fragments")
- {
- keyMaterials[curentMaterial] += curentQuantiti;
- }
- else
- {
- if (!junkMaterials.ContainsKey(curentMaterial))
- {
- junkMaterials.Add(curentMaterial, 0);
- }
- junkMaterials[curentMaterial] += curentQuantiti;
- }
- i += 1;
- if (keyMaterials["shards"] >= 250 || keyMaterials["motes"] >= 250 || keyMaterials["fragments"] >= 250)
- {
- foreach (var item in keyMaterials.OrderByDescending(x => x.Value))
- {
- switch (item.Key)
- {
- case "motes":
- Console.WriteLine("Dragonwrath obtained!");
- keyMaterials[item.Key] -= 250;
- break;
- case "shards":
- Console.WriteLine("Shadowmourne obtained!");
- keyMaterials[item.Key] -= 250;
- break;
- case "fragments":
- Console.WriteLine("Valanyr obtained!");
- keyMaterials[item.Key] -= 250;
- break;
- }
- break;
- }
- foreach (var item in keyMaterials.OrderByDescending(x => x.Value).ThenBy(x => x.Key))
- {
- Console.WriteLine("{0}: {1}", item.Key, item.Value);
- }
- foreach (var item in junkMaterials)
- {
- Console.WriteLine("{0}: {1}", item.Key, item.Value);
- }
- isInput = false;
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment