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 Program
- {
- static void Main(string[] args)
- {
- int[] arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int k = int.Parse(Console.ReadLine());
- int[] sumArray = new int[arr.Length];
- int[] myNewArray = new int[arr.Length];
- for (int j = 0; j < k; j++)
- {
- for (int i = 0; i < arr.Length-1; i++)
- {
- myNewArray[i] = arr[(i + 1) % arr.Length];
- sumArray[i] += myNewArray[i];
- }
- }
- Console.WriteLine(string.Join(" ", sumArray));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment