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;
- public class AppendLists
- {
- public static void Main()
- {
- var nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int[] firstHalf = new int[nums.Length / 2];
- int[] secondHalf = new int[nums.Length / 2];
- int[] firstSum = new int[nums.Length / 2];
- int[] secondSum = new int[nums.Length / 2];
- for (int i = 0; i < nums.Length / 2; i++)
- {
- firstHalf[i] = nums[i];
- }
- for (int i = 0; i < nums.Length / 2; i++)
- {
- secondHalf[i] = nums[nums.Length / 2 + i];
- }
- for (int i = 0; i < firstHalf.Length / 2; i++)
- {
- firstSum[i] = firstHalf[i] + firstHalf[firstHalf.Length - 1 - i];
- secondSum[i] = secondHalf[i] + secondHalf[firstHalf.Length - 1 - i];
- }
- int index = 0;
- for (int i = firstSum.Length / 2; i < firstSum.Length; i++)
- {
- firstSum[i] = secondSum[index];
- index++;
- }
- Console.WriteLine(string.Join(" ", firstSum));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement