Advertisement
Guest User

Untitled

a guest
Oct 16th, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 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. class Program
  8. {
  9. static void Main()
  10. {
  11. int n = int.Parse(Console.ReadLine());
  12.  
  13. var inputs = new List<string>();
  14.  
  15. for (int i = 0; i < n; i++)
  16. {
  17. inputs.Add(Console.ReadLine());
  18. }
  19.  
  20. string[] types = Console.ReadLine().Split(' ');
  21. string fail = types[0];
  22. string root = types[2];
  23.  
  24. int count = 0;
  25. var result = new Dictionary<string, string>();
  26.  
  27. for (int i = 0; i < n; i++)
  28. {
  29. string[] split = inputs[i].Split(new char[] { '\\', ';' }).ToArray();
  30.  
  31. if (split[0] == root)
  32. {
  33. string[] splitFial = split[split.Length - 2].Split('.').ToArray();
  34.  
  35. if (splitFial[1] == fail)
  36. {
  37. result.Add(split[split.Length - 2], split[split.Length - 1]);
  38. count++;
  39. }
  40. }
  41. }
  42.  
  43. if (count == 0)
  44. {
  45. Console.WriteLine("No");
  46. }
  47. else
  48. {
  49. var sorted = result.OrderByDescending(r => r.Value).ThenBy(r => r.Key);
  50.  
  51. foreach (var item in sorted)
  52. {
  53. Console.WriteLine($"{item.Key} - {item.Value} KB");
  54. }
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement