Advertisement
YavorGrancharov

Tear_List_in_Half

Jun 24th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 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. namespace Tear_List_in_Half
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             List<int> list = Console.ReadLine()
  14.                 .Split(' ')
  15.                 .Select(int.Parse)
  16.                 .ToList();
  17.  
  18.             List<int> emptyUp = new List<int>();
  19.             List<int> emptyBottom = new List<int>();
  20.  
  21.             for (int i = list.Count / 2; i < list.Count; i++)
  22.             {
  23.                 emptyUp.Add(list[i]);
  24.             }
  25.  
  26.             for (int i = 0; i < list.Count / 2; i++)
  27.             {
  28.                 emptyBottom.Add(list[i]);
  29.             }
  30.  
  31.             List<int> result = new List<int>();
  32.  
  33.             for (int i = 0; i < emptyUp.Count; i++)
  34.             {
  35.                 result.Add(emptyUp[i] / 10);
  36.                 result.Add(emptyBottom[i]);
  37.                 result.Add(emptyUp[i] % 10);
  38.             }
  39.             Console.WriteLine(string.Join(" ", result));
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement