Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text.RegularExpressions;
- using System.Text;
- namespace _02._Boss_Rush
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, List<string>> team = new Dictionary<string, List<string>>();
- Dictionary<string, int> time = new Dictionary<string, int>();
- string[] command = Console.ReadLine().Split("; ");
- int total = 0;
- while (command[0] != "start of concert")
- {
- List<string> members = command[2].Split(", ").ToList();
- if (command[0] == "Add")
- {
- if (team.ContainsKey(command[1]))
- {
- for (int i = 0; i < members.Count; i++)
- {
- if (!team[command[1]].Contains(members[i]))
- {
- team[command[1]].Add(members[i]);
- }
- }
- }
- else
- {
- team[command[1]] = new List<string>();
- team[command[1]].AddRange(members);
- }
- }
- if (command[0] == "Play")
- {
- total += int.Parse(command[2]);
- if (time.ContainsKey(command[1]))
- {
- time[command[1]] += int.Parse(command[2]);
- }
- else
- {
- time[command[1]] = int.Parse(command[2]);
- }
- }
- command = Console.ReadLine().Split("; ");
- }
- Console.WriteLine($"Total time: {total}");
- foreach (var item in time.OrderByDescending(x => x.Value).ThenBy(x => x.Key))
- {
- Console.WriteLine($"{item.Key} -> {item.Value}");
- }
- string band = Console.ReadLine();
- Console.WriteLine(band);
- foreach (var item in team.Keys)
- {
- if (item == band)
- {
- foreach (var member in team[item])
- {
- Console.WriteLine($"=> {member}");
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement