Advertisement
Guest User

Untitled

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