Advertisement
Guest User

9.* Legendary Farming

a guest
Oct 13th, 2016
885
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 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 _02.Rotate_and_Sum
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Dictionary<string, long> keyMaterial = new Dictionary<string, long>();
  14.  
  15. keyMaterial["shards"] = 0;
  16. keyMaterial["fragments"] = 0;
  17. keyMaterial["motes"] = 0;
  18.  
  19. Dictionary<string, long> notKeyMaterial = new Dictionary<string, long>();
  20.  
  21. bool getMaterial = true;
  22. string win = "";
  23.  
  24. while (getMaterial)
  25. {
  26. List<string> list = Console.ReadLine().Split(' ').ToList();
  27. for (int i = 0; i < list.Count; i = i + 2)
  28. {
  29. long quloty = long.Parse(list[i]);
  30. string material = list[i + 1].ToLower();
  31.  
  32. if (keyMaterial.ContainsKey(material))
  33. {
  34. keyMaterial[material] += quloty;
  35. if (keyMaterial[material] > 250)
  36. {
  37. win = material;
  38. keyMaterial[material] -= 250;
  39. getMaterial = false;
  40. break;
  41. }
  42. }
  43. else
  44. {
  45. if (!notKeyMaterial.ContainsKey(material))
  46. {
  47. notKeyMaterial[material] = 0;
  48. }
  49.  
  50. notKeyMaterial[material] += quloty;
  51.  
  52. }
  53. }
  54. }
  55.  
  56.  
  57. string first = WindMethod(win);
  58. Console.WriteLine(WindMethod(win)+ " obtained!");
  59.  
  60. keyMaterial = keyMaterial
  61. .OrderBy(x => x.Key)
  62. .OrderByDescending(x => x.Value)
  63. .ToDictionary(x => x.Key, x => x.Value);
  64.  
  65. notKeyMaterial = notKeyMaterial
  66. .OrderBy(x => x.Key)
  67. .ToDictionary(x => x.Key, y => y.Value);
  68.  
  69. foreach (var pait in keyMaterial)
  70. {
  71. Console.WriteLine("{0}: {1}", pait.Key, pait.Value);
  72. }
  73. foreach (var pair in notKeyMaterial)
  74. {
  75. Console.WriteLine("{0}: {1}", pair.Key, pair.Value);
  76. }
  77.  
  78.  
  79. }
  80.  
  81. private static string WindMethod(string win)
  82. {
  83. switch (win)
  84. {
  85. case "motes": return "Dragonwrath"; break;
  86. case "fragments": return "Valanyr"; break;
  87. case "shards": return "Shadowmourne"; break;
  88. default: return "goran"; break;
  89.  
  90. }
  91. }
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement