Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace GaussTrick
  8. {
  9.     class Program
  10.     {              
  11.         static void Main(string[] args)
  12.         {
  13.             List<int> numbers = Console.ReadLine()
  14.                 .Split()
  15.                 .Select(int.Parse)
  16.                 .ToList();
  17.             int originalLength = numbers.Count;
  18.             for (int i = 0; i < originalLength/2; i++)
  19.             {
  20.                 numbers[i] += numbers[numbers.Count - 1];
  21.                 numbers.RemoveAt(numbers.Count - 1);
  22.             }
  23.             Console.WriteLine(string.Join(" ",numbers));
  24.         }
  25.        
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement