Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- class Program
- {
- static void Main()
- {
- int[] arr = Console.ReadLine()
- .Split(' ')
- .Select(int.Parse)
- .ToArray();
- int rotations = int.Parse(Console.ReadLine());
- var sum = new int[arr.Length];
- int lastElement = 0;
- for (int i = 0; i < rotations; i++)
- {
- lastElement = arr[arr.Length - 1];
- for (int j = arr.Length - 1; j >= 1; j--)
- {
- arr[j] = arr[j - 1];
- }
- arr[0] = lastElement;
- for (int k = 0; k < arr.Length; k++)
- {
- sum[k] += arr[k];
- }
- }
- Console.WriteLine(string.Join(" ", sum));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement