Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class Program
- {
- static void Main()
- {
- int[] mainMasiv = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int[] condensedMasiv = new int[mainMasiv.Length - 1];
- if (mainMasiv.Length == 1)
- {
- Console.WriteLine(mainMasiv[0]);
- return;
- }
- for (int i = 0; i < mainMasiv.Length; i++)
- {
- for (int j = 0; j < condensedMasiv.Length - i; j++)
- {
- condensedMasiv[j] = mainMasiv[j] + mainMasiv[j + 1];
- }
- mainMasiv = condensedMasiv;
- }
- Console.WriteLine(condensedMasiv[0]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement