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 RotateAndSum
- {
- class RotateAndSum
- {
- static void Main(string[] args)
- {
- var array = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int rotations = int.Parse(Console.ReadLine());
- int[] sum = new int[array.Length];
- for (int i = 0; i < rotations; i++)
- {
- var last = array[array.Length - 1];
- for (int j = array.Length - 1; j > 0; j--)
- {
- array[j] = array[j - 1];
- }
- array[0] = last;
- for (int k = 0; k < array.Length; k++)
- {
- sum[k] += array[k];
- }
- }
- Console.WriteLine(string.Join(" ", sum));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement