Advertisement
Guest User

Untitled

a guest
Oct 9th, 2016
533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace _02.Rotate_and_Sum
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. var input = Console.ReadLine().Split().Select(int.Parse).ToList();
  11. int[] sum = new int[input.Count];
  12.  
  13. int k = int.Parse(Console.ReadLine());
  14.  
  15. for (int i = 0; i < k; i++)
  16. {
  17. input.Insert(0, input[input.Count - 1]);
  18. input.RemoveAt(input.Count - 1);
  19.  
  20. for (int j = 0; j < input.Count; j++)
  21. {
  22. sum[j] = sum[j] + input[j];
  23. }
  24.  
  25. }
  26.  
  27. Console.WriteLine(string.Join(" ",sum));
  28.  
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement