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 _05ListExcercisesTearListInHalf
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> InputTokens = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- List<int> movedInts = new List<int>(InputTokens);
- int count = 0;
- int remove = Math.Max(0, InputTokens.Count/2);
- movedInts.RemoveRange(0,InputTokens.Count / 2);
- InputTokens.RemoveRange((InputTokens.Count / 2),remove);
- //input done TODO logic of spliting the digits and adding them to the List
- for(int i=0;i<movedInts.Count;i++)
- {
- int result = movedInts[i];
- for (;result != 0; result /= 10)
- {
- if (count == 0)
- {
- InputTokens.Insert((i * 3)+1, result%10);
- count++;
- }
- else
- {
- InputTokens.Insert((i * 3) , result%10);
- count = 0;
- }
- }
- }
- Console.WriteLine(string.Join(" ",InputTokens));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment