Advertisement
Guest User

Untitled

a guest
Sep 8th, 2016
3,380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8.  
  9. int[] mainMasiv = Console.ReadLine().Split().Select(int.Parse).ToArray();
  10. int[] condensedMasiv = new int[mainMasiv.Length - 1];
  11.  
  12. if (mainMasiv.Length == 1)
  13. {
  14. Console.WriteLine(mainMasiv[0]);
  15. return;
  16. }
  17.  
  18. for (int i = 0; i < mainMasiv.Length; i++)
  19. {
  20. for (int j = 0; j < condensedMasiv.Length - i; j++)
  21. {
  22. condensedMasiv[j] = mainMasiv[j] + mainMasiv[j + 1];
  23. }
  24. mainMasiv = condensedMasiv;
  25. }
  26. Console.WriteLine(condensedMasiv[0]);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement