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)
- {
- Dictionary<string, int> keyMat = new Dictionary<string, int>();
- keyMat["shards"] = 0;
- keyMat["fragments"] = 0;
- keyMat["motes"] = 0;
- Dictionary<string, int> junkMat = new Dictionary<string, int>();
- while (true)
- {
- List<string> input = Console.ReadLine().Split(' ').ToList();
- for (int i = 0; i < input.Count; i = i + 2)
- {
- int quantity = int.Parse(input[i]);
- string material = input[i + 1].ToLower();
- if (keyMat.ContainsKey(material))
- {
- keyMat[material] += quantity;
- switch (material)
- {
- case "shards":
- if (quantity >= 250)
- {
- Console.WriteLine("Shadowmourne obtained!");
- keyMat[material] -= 250;
- break;
- }
- else
- {
- continue;
- }
- case "fragments":
- if (quantity >= 250)
- {
- Console.WriteLine("Valanyr obtained!");
- keyMat[material] -= 250;
- break;
- }
- else
- {
- continue;
- }
- case "motes":
- if (quantity >= 250)
- {
- Console.WriteLine("Dragonwrath obtained!");
- keyMat[material] -= 250;
- break;
- }
- else
- {
- continue;
- }
- default:
- break;
- }
- }
- else
- {
- if ((!junkMat.ContainsKey(material)))
- {
- junkMat.Add(material, 0);
- }
- junkMat[material] += quantity;
- continue;
- }
- }
- }
- Dictionary<string, int> keyMatResult = keyMat.OrderByDescending(kvp => keyMat.Values).ThenBy(kvp => keyMat.Keys).ToDictionary(a => a.Key, a => a.Value);
- foreach (var item in keyMatResult)
- {
- Console.WriteLine($"{item.Key}: {item.Value}");
- }
- Dictionary<string, int> junkMatResult = junkMat.OrderBy(kvp => junkMat.Values).ToDictionary(a => a.Key, a => a.Value);
- foreach (var item in junkMatResult)
- {
- Console.WriteLine($"{item.Key}: {item.Value}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement