miroslavbstoyanov

Untitled

Oct 15th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 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 _03.A_Miner_Task
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string inputKey = Console.ReadLine();
  14. long inputValue = long.Parse(Console.ReadLine());
  15.  
  16.  
  17. var minerTaskDict = new Dictionary<string, long>();
  18.  
  19. while (inputKey != "stop")
  20. {
  21.  
  22. if (!minerTaskDict.ContainsKey(inputKey))
  23. {
  24. minerTaskDict.Add(inputKey, 0);
  25. }
  26.  
  27. minerTaskDict[inputKey] += inputValue;
  28.  
  29.  
  30. inputKey = Console.ReadLine();
  31.  
  32. if (inputKey == "stop")
  33. {
  34. foreach (var item in minerTaskDict.Keys)
  35. {
  36. Console.WriteLine(item + " -> " + minerTaskDict[item]);
  37. }
  38. return;
  39. }
  40.  
  41. inputValue = long.Parse(Console.ReadLine());
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment