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 _03.A_Miner_Task
- {
- class Program
- {
- static void Main(string[] args)
- {
- var minerTask = new Dictionary<string, int>();
- bool continueRead = true;
- while (continueRead)
- {
- string material = Console.ReadLine();
- if (material == "stop")
- {
- continueRead = false;
- foreach (var item in minerTask)
- {
- Console.WriteLine($"{item.Key} -> {item.Value}");
- }
- }
- else
- {
- int valueMaterial = int.Parse(Console.ReadLine());
- if(minerTask.ContainsKey(material))
- {
- minerTask[material] += valueMaterial;
- }
- else
- {
- minerTask.Add(material, valueMaterial);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement