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;
- //You will receive a list of integers on the first input line (space-separated). Your task is to separate the list into two parts and //perform the following operations
- namespace Tear_list_in_half
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> input = Console.ReadLine().Split().Select(int.Parse).ToList();
- List<int> tempList = input.GetRange(input.Count / 2, input.Count / 2);
- input.RemoveRange(input.Count / 2, input.Count / 2);
- for (int i = 0; i < tempList.Count; i++)
- {
- int firstDigit = tempList[i] / 10;
- input.Insert(i*3, firstDigit);
- int secondDigit = tempList[i] % 10;
- input.Insert(i * 3 + 2, secondDigit);
- }
- Console.WriteLine(string.Join(" ", input));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement