Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace _02._Gauss__Trick
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> numbers = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToList();
- List<int> result = new List<int>();
- for (int i = 0; i < numbers.Count/2 ; i++)
- {
- result.Add(numbers[i] + numbers[numbers.Count - 1-i]);
- }
- if (numbers.Count % 2 == 1)
- {
- result.Add(numbers.Count / 2 + 1);
- }
- Console.WriteLine(string.Join(" ", result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment