Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _05.TearListInHalf
- {
- class Program
- {
- static void Main(string[] args)
- {
- var numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
- var firstPart = new List<int>();
- var secondPart = new List<int>();
- var separated = new List<int>();
- for (int i = 0; i < numbers.Count/2; i++)
- {
- firstPart.Add(numbers[i]);
- }
- for (int j = numbers.Count-1; j >= numbers.Count/2; j--)
- {
- secondPart.Add(numbers[j]);
- }
- secondPart.Reverse();
- for (int i = 0; i < secondPart.Count; i++)
- {
- int firstDigit = secondPart[i] / 10;
- int secondDigit = secondPart[i] % 10;
- separated.Add(firstDigit);
- for (int j = 0; j < firstPart.Count; j++)
- {
- separated.Add(firstPart[j]);
- firstPart[j] = firstPart[j + 1];
- break;
- }
- separated.Add(secondDigit);
- }
- Console.WriteLine(string.Join(" ",separated));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement