Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Arrays
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int rotations = int.Parse(Console.ReadLine());
- int[] rotated = new int[nums.Length];
- int[] arrSum = new int[nums.Length];
- while (rotations > 0)
- {
- rotated = new int[nums.Length];
- rotated[0] = nums[nums.Length - 1];
- arrSum[0] += rotated[0];
- for (int i = 1; i < nums.Length; i++)
- {
- rotated[i] = nums[i - 1];
- arrSum[i] += rotated[i];
- }
- rotations--;
- nums = rotated;
- }
- Console.WriteLine(string.Join(" ", arrSum));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement