Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace HW
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- List<int> secondHalf = new List<int>(list.Count / 2);
- int tenths, digit, index = 0;
- for (int i = list.Count / 2; i < list.Count; i++)
- {
- secondHalf.Add(list[i]);
- list.RemoveAt(i); i--;
- }
- //foreach (int number in secondHalf) list.Remove(number);
- //list = list.Take(list.Count / 2).ToList(); //
- foreach (int number in secondHalf)
- {
- tenths = number / 10;
- digit = number % 10;
- list.Insert(index, tenths);
- index += 2;
- list.Insert(index, digit);
- index++;
- }
- Console.WriteLine(string.Join(" ", list));
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement