Advertisement
kmer

Untitled

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