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