Advertisement
Guest User

Legendary Farming

a guest
Oct 18th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _09.Legendary_Farming
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             Dictionary<string, long> points = new Dictionary<string, long>();
  15.             Dictionary<string, long> elementsJunk = new Dictionary<string, long>();
  16.             Dictionary<string, long> elementsLegendary = new Dictionary<string, long>();
  17.             points.Add("Shadowmourne", 0);
  18.             points.Add("Valanyr", 0);
  19.             points.Add("Dragonwrath", 0);
  20.             elementsLegendary.Add("fragments", 0);
  21.             elementsLegendary.Add("shards", 0);
  22.             elementsLegendary.Add("motes", 0);
  23.            
  24.  
  25.            
  26.            
  27.             while (true)
  28.             {
  29.                 var input = Console.ReadLine().Split(' ').ToArray();
  30.                
  31.                 for (int i = 0; i < input.Length; i++)
  32.                 {
  33.                    
  34.                     if (i % 2 != 0)
  35.                     {
  36.                      
  37.                        
  38.                         //Console.WriteLine(couple);
  39.  
  40.                         if (elementsLegendary.ContainsKey(input[i].ToLower()))
  41.                         {
  42.                             elementsLegendary[input[i].ToLower()] += int.Parse(input[i-1]);
  43.                         }
  44.                         else
  45.                         {
  46.                             if (elementsJunk.ContainsKey(input[i].ToLower()))
  47.                             {
  48.                                 elementsJunk[input[i].ToLower()] += int.Parse(input[i - 1]);
  49.                             }
  50.                             else
  51.                             {
  52.                                 elementsJunk[input[i].ToLower()] = int.Parse(input[i - 1]);
  53.                             }
  54.                         }
  55.  
  56.                         if (input[i].ToLower() == "motes")
  57.                         {
  58.                             points["Dragonwrath"] += int.Parse(input[i - 1]);
  59.                         }
  60.                         else if (input[i].ToLower() == "shards")
  61.                         {
  62.                             points["Shadowmourne"] += int.Parse(input[i - 1]);
  63.                         }
  64.                         else if (input[i].ToLower() == "fragments")
  65.                         {
  66.                             points["Valanyr"] += int.Parse(input[i - 1]);
  67.                         }
  68.                      
  69.                     }
  70.  
  71.                     if (points["Valanyr"] >= 250)
  72.                     {
  73.                         elementsLegendary["fragments"] -= 250;
  74.                         Console.WriteLine("Valanyr obtained!");
  75.                        
  76.                         goto Output;
  77.                     }
  78.                     else if (points["Shadowmourne"] >= 250)
  79.                     {
  80.                         elementsLegendary["shards"] -= 250;
  81.                         Console.WriteLine("Shadowmourne obtained!");
  82.                        
  83.                         goto Output;
  84.                     }
  85.                     else if (points["Dragonwrath"] >= 250)
  86.                     {
  87.                         elementsLegendary["motes"] -= 250;
  88.                         Console.WriteLine("Dragonwrath obtained!");
  89.                         goto Output;
  90.                     }
  91.  
  92.                 }
  93.  
  94.  
  95.             }
  96.  
  97.  
  98.             Output:
  99.             foreach (KeyValuePair<string, long> pair in elementsLegendary.OrderByDescending(c => c.Value))
  100.             {
  101.                 Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
  102.             }
  103.             foreach (KeyValuePair<string, long> pair in elementsJunk.OrderBy(c => c.Key))
  104.             {
  105.                 Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
  106.             }
  107.  
  108.  
  109.         }
  110.     }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement