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