Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. sing System.Collections.Generic;
  2. using System.Linq;
  3. using System.Text;
  4. using System.Threading.Tasks;
  5.  
  6. namespace UnunionList
  7. {
  8. class Program
  9. {
  10. static void Main()
  11. {
  12. List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
  13.  
  14. int n = int.Parse(Console.ReadLine());
  15. for (int i = 0; i < n; i++)
  16. {
  17. var list = Console.ReadLine().Split().Select(int.Parse).ToList();
  18.  
  19. for (int j = 0; j < list.Count; j++)
  20. {
  21. if (numbers.Contains(list[j]))
  22. {
  23. numbers.RemoveAll(x => x == list[j]);
  24. }
  25. else
  26. {
  27. numbers.Add(list[j]);
  28.  
  29. }
  30. }
  31. }
  32. numbers.Sort();
  33. Console.WriteLine(string.Join(" ", numbers));
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement