Advertisement
Guest User

123

a guest
Jun 24th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace HW
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<int> list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  12.             List<int> secondHalf = new List<int>(list.Count / 2);
  13.             int tenths, digit, index = 0;
  14.             for (int i = list.Count / 2; i < list.Count; i++)
  15.             {
  16.                 secondHalf.Add(list[i]);
  17.                 list.RemoveAt(i); i--;
  18.             }
  19.             //foreach (int number in secondHalf) list.Remove(number);
  20.             //list = list.Take(list.Count / 2).ToList(); //
  21.             foreach (int number in secondHalf)
  22.             {
  23.                 tenths = number / 10;
  24.                 digit = number % 10;
  25.                 list.Insert(index, tenths);
  26.                 index += 2;
  27.                 list.Insert(index, digit);
  28.                 index++;
  29.             }
  30.             Console.WriteLine(string.Join(" ", list));
  31.             Console.ReadLine();
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement