Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Buffers;
- namespace ArratRotatiom
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[] arr = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .ToArray();
- int n = int.Parse(Console.ReadLine());
- n %= arr.Length;
- int count = n;
- int[] arr2 = new int[arr.Length];
- if (arr.Length == 1)
- {
- Console.WriteLine(arr[0]);
- return;
- }
- //if (n > arr.Length)
- //{
- // for (int i = 0; i < n - arr.Length; i++)
- // {
- //
- // arr2[arr.Length - i - 1] = arr[i];
- // }
- // count = 0;
- // for (int i = n - arr.Length; i < arr.Length; i++)
- // {
- // arr2[count] = arr[i];
- // count++;
- // }
- // Console.WriteLine(string.Join(" ", arr2));
- // return;
- //}
- for (int i = 0; i < n; i++)
- {
- arr2[arr.Length - count] = arr[i];
- count--;
- }
- count = 0;
- for (int i = n; i < arr.Length; i++)
- {
- arr2[count] = arr[i];
- count++;
- }
- Console.WriteLine(string.Join(" ", arr2));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement