G_Borisov

Untitled

Mar 20th, 2016
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FoldingNumbers
  4. {
  5. class FoldAndSum
  6. {
  7. static void Main(string[] args)
  8. {
  9. int n = int.Parse(Console.ReadLine())*4;
  10. int[] arrOriginal = new int[n];
  11. int[] arrA = new int[n / 2];
  12. int[] arrB = new int[n / 2];
  13. int countA = 0;
  14. int countB = 0;
  15. for (int i = 0; i < n; i+=1)
  16. {
  17. arrOriginal[i] = int.Parse(Console.ReadLine());
  18. if (i >= n && i < 3 * n)
  19. {
  20. arrA[countA] = arrOriginal[i];
  21. countA += 1;
  22. }
  23. else if (i < n)
  24. {
  25. arrB[(n-1)-countB] = arrOriginal[i];
  26. countB += 1;
  27. }
  28. else if (i >= 3 * n)
  29. {
  30. arrB[countB+(n-1)] = arrOriginal[i];
  31. countB -= 1;
  32. }
  33. }
  34. for (int j = 0; j < n*2; j+=1)
  35. {
  36. int sum = (arrA[j]) + (arrB[j]);
  37. Console.Write(sum + " ");
  38. }
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment