Problem list
Log in
#r03245 · Online Judge > GoldOJ

Number Rotation

Bronze II 2.0 s 256 MB

Given $N$ numbers, print $N$ lines: the first is the original order, and each subsequent line rotates the whole sequence one step to the right (the last element moves to the front).

Input

Line 1: $N$ ($1 \le N \le 1000$). Line 2: $N$ integers in $[1, 1000]$.

Output

Print the $N$ successive right-rotations, one per line.

Example 1

Input
5
12 45 78 23 56
Output
12 45 78 23 56
56 12 45 78 23
23 56 12 45 78
78 23 56 12 45
45 78 23 56 12
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code