Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _03FoldandSum
- {
- class FoldAndSum
- {
- static void Main()
- {
- var nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- var result = new int[nums.Length / 2];
- for (int i = 0; i < nums.Length / 4; i++)
- {
- result[i] = (nums[nums.Length / 4 - 1 - i] + nums[i + nums.Length / 4]);
- }
- for (int i = 0; i < nums.Length / 4; i++)
- {
- result[result.Length / 2 + i] = (nums[nums.Length - i - 1] + nums[(i + nums.Length / 2)]);
- }
- Console.WriteLine(string.Join(" ", result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement