report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Array rotation - MarisaOJ: Marisa Online Judge

Array rotation

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ consisting of $n$ integers. Perform a left rotation of the array $k$ times and then print the resulting array. For example, given array $A = (1, 2, 3, 4, 5)$, after performing a left rotation $1$ time, it becomes $(2, 3, 4, 5, 1)$ (the first element moves to the end). ### Input - The first line contains two integers $n$ and $k$. - The second line contains $n$ integers $A_i$. ### Output - Print the array after performing a left rotation $k$ times. ### Constraints - $1 \le k \le n \le 100$. - $1 \le A_i \le 100$. ### Sample test ``` 5 2 1 2 3 4 5 ``` Output: ``` 3 4 5 1 2 ```
Array
Even elements
Smallest value
Average
Array reversal
Negative and positive
Consecutive differences
Largest value
Positive and negative
Dominant element
Second largest
Maximum product
Array rotation
Palindrome array
Circle
Insert
Positive subarray
Sorting
Similar Arrays
Unique
Unique 2
Frequent value
Most Frequent Value
Bitonic sequence
Swap
Topic
Basic
Rating 800
Solution (0) Solution