Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace legendaryFarming
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. Dictionary<string, int> keyMat = new Dictionary<string, int>();
  12. keyMat["shards"] = 0;
  13. keyMat["fragments"] = 0;
  14. keyMat["motes"] = 0;
  15. Dictionary<string, int> junkMat = new Dictionary<string, int>();
  16.  
  17. while (true)
  18. {
  19. List<string> input = Console.ReadLine().Split(' ').ToList();
  20.  
  21. for (int i = 0; i < input.Count; i = i + 2)
  22. {
  23. int quantity = int.Parse(input[i]);
  24. string material = input[i + 1].ToLower();
  25.  
  26.  
  27. if (keyMat.ContainsKey(material))
  28. {
  29. keyMat[material] += quantity;
  30.  
  31. switch (material)
  32. {
  33. case "shards":
  34. if (quantity >= 250)
  35. {
  36. Console.WriteLine("Shadowmourne obtained!");
  37. keyMat[material] -= 250;
  38. break;
  39. }
  40. else
  41. {
  42. continue;
  43. }
  44.  
  45. case "fragments":
  46. if (quantity >= 250)
  47. {
  48. Console.WriteLine("Valanyr obtained!");
  49. keyMat[material] -= 250;
  50. break;
  51. }
  52. else
  53. {
  54. continue;
  55. }
  56.  
  57. case "motes":
  58. if (quantity >= 250)
  59. {
  60. Console.WriteLine("Dragonwrath obtained!");
  61. keyMat[material] -= 250;
  62. break;
  63. }
  64. else
  65. {
  66. continue;
  67. }
  68.  
  69. default:
  70. break;
  71.  
  72. }
  73.  
  74. }
  75. else
  76. {
  77. if ((!junkMat.ContainsKey(material)))
  78. {
  79.  
  80. junkMat.Add(material, 0);
  81. }
  82.  
  83. junkMat[material] += quantity;
  84. continue;
  85.  
  86.  
  87. }
  88.  
  89.  
  90. }
  91. }
  92.  
  93.  
  94. Dictionary<string, int> keyMatResult = keyMat.OrderByDescending(kvp => keyMat.Values).ThenBy(kvp => keyMat.Keys).ToDictionary(a => a.Key, a => a.Value);
  95.  
  96.  
  97. foreach (var item in keyMatResult)
  98. {
  99. Console.WriteLine($"{item.Key}: {item.Value}");
  100. }
  101. Dictionary<string, int> junkMatResult = junkMat.OrderBy(kvp => junkMat.Values).ToDictionary(a => a.Key, a => a.Value);
  102.  
  103.  
  104. foreach (var item in junkMatResult)
  105. {
  106. Console.WriteLine($"{item.Key}: {item.Value}");
  107. }
  108.  
  109.  
  110. }
  111. }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement