Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ExamPreparation
- {
- class Startup
- {
- static void Main()
- {
- int[] numbers = Console.ReadLine()
- .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
- .Select(int.Parse)
- .ToArray();
- while (numbers.Length > 1)
- {
- int[] condensed = new int[numbers.Length - 1];
- for (int i = 0; i < numbers.Length - 1; i++)
- {
- condensed[i] = numbers[i] + numbers[i + 1];
- }
- numbers = condensed;
- }
- Console.WriteLine(numbers[0]);
- }
- }
- }
Add Comment
Please, Sign In to add comment