Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _09.Legendary_Farming
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, long> points = new Dictionary<string, long>();
- Dictionary<string, long> elementsJunk = new Dictionary<string, long>();
- Dictionary<string, long> elementsLegendary = new Dictionary<string, long>();
- points.Add("Shadowmourne", 0);
- points.Add("Valanyr", 0);
- points.Add("Dragonwrath", 0);
- elementsLegendary.Add("fragments", 0);
- elementsLegendary.Add("shards", 0);
- elementsLegendary.Add("motes", 0);
- while (true)
- {
- var input = Console.ReadLine().Split(' ').ToArray();
- for (int i = 0; i < input.Length; i++)
- {
- if (i % 2 != 0)
- {
- //Console.WriteLine(couple);
- if (elementsLegendary.ContainsKey(input[i].ToLower()))
- {
- elementsLegendary[input[i].ToLower()] += int.Parse(input[i-1]);
- }
- else
- {
- if (elementsJunk.ContainsKey(input[i].ToLower()))
- {
- elementsJunk[input[i].ToLower()] += int.Parse(input[i - 1]);
- }
- else
- {
- elementsJunk[input[i].ToLower()] = int.Parse(input[i - 1]);
- }
- }
- if (input[i].ToLower() == "motes")
- {
- points["Dragonwrath"] += int.Parse(input[i - 1]);
- }
- else if (input[i].ToLower() == "shards")
- {
- points["Shadowmourne"] += int.Parse(input[i - 1]);
- }
- else if (input[i].ToLower() == "fragments")
- {
- points["Valanyr"] += int.Parse(input[i - 1]);
- }
- }
- if (points["Valanyr"] >= 250)
- {
- elementsLegendary["fragments"] -= 250;
- Console.WriteLine("Valanyr obtained!");
- goto Output;
- }
- else if (points["Shadowmourne"] >= 250)
- {
- elementsLegendary["shards"] -= 250;
- Console.WriteLine("Shadowmourne obtained!");
- goto Output;
- }
- else if (points["Dragonwrath"] >= 250)
- {
- elementsLegendary["motes"] -= 250;
- Console.WriteLine("Dragonwrath obtained!");
- goto Output;
- }
- }
- }
- Output:
- foreach (KeyValuePair<string, long> pair in elementsLegendary.OrderByDescending(c => c.Value))
- {
- Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
- }
- foreach (KeyValuePair<string, long> pair in elementsJunk.OrderBy(c => c.Key))
- {
- Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement