Advertisement
Guest User

Untitled

a guest
Nov 4th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9.  
  10. Dictionary<string, Dictionary<string, List<int>>> pokeDict =
  11. new Dictionary<string, Dictionary<string, List<int>>>();
  12.  
  13. while (true)
  14. {
  15. string[] input = Console.ReadLine()
  16. .Split(new string[] { " -> " }, StringSplitOptions.RemoveEmptyEntries)
  17. .ToArray();
  18. string pokemonName = input[0];
  19. string evolutionType;
  20. int evolutionIndex;
  21.  
  22. if (input[0] == "wubbalubbadubdub")
  23. {
  24. break;
  25. }
  26. if (input.Length > 1)
  27. {
  28. evolutionType = input[1];
  29. evolutionIndex = int.Parse(input[2]);
  30. }
  31. else
  32. {
  33. if (pokeDict.ContainsKey(pokemonName))
  34. {
  35. PrintPokemonWithSpecialCommand(pokeDict, pokemonName);
  36. }
  37. continue;
  38. }
  39.  
  40. if (!pokeDict.ContainsKey(pokemonName))
  41. {
  42. pokeDict.Add(pokemonName, new Dictionary<string, List<int>>());
  43. }
  44. if (!pokeDict[pokemonName].ContainsKey(evolutionType))
  45. {
  46. pokeDict[pokemonName].Add(evolutionType, new List<int>());
  47. }
  48.  
  49. pokeDict[pokemonName][evolutionType].Add(evolutionIndex);
  50. }
  51. PrintCurrentPokemons(pokeDict);
  52. }
  53.  
  54. private static void PrintPokemonWithSpecialCommand(Dictionary<string, Dictionary<string, List<int>>> pokeDict, string pokeM)
  55. {
  56.  
  57.  
  58. }
  59.  
  60. private static void PrintCurrentPokemons(Dictionary<string, Dictionary<string, List<int>>> pokeDict)
  61. {
  62.  
  63. foreach (var pokemon in pokeDict)
  64. {
  65. Dictionary<string, List<int>> pokemons = pokemon.Value;
  66.  
  67. Console.WriteLine("# " + pokemon.Key);
  68. var pokes = pokemons.OrderByDescending(x => x.Value.Sum()).ToDictionary(z=>z.Key, a=>a.Value);
  69.  
  70. foreach (var poke in pokes)
  71. {
  72. List<int> list = poke.Value;
  73.  
  74. foreach (var l in poke.Value)
  75. {
  76. Console.WriteLine(poke.Key + " <-> " + l);
  77. }
  78. }
  79. }
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement