Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace listsExercises
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> primal = Console.ReadLine().Split().Select(int.Parse).ToList();
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- List<int> list = Console.ReadLine().Split().Select(int.Parse).ToList();
- for(int j=0; j<primal.Count; j++)
- {
- for(int k=0; k<list.Count; k++)
- {
- if (primal[j] == list[k])
- {
- primal.RemoveAt(j);
- list.RemoveAt(k);
- k = 0;
- j = 0;
- }
- }
- }
- primal.AddRange(list);
- primal.Sort();
- }
- Console.WriteLine(string.Join(" ", primal));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement