1153:0 start-up algorithm 60--element forward 1-bit time limit:1 Sec Memory limit:64 MB 64bit IO Format:%lld
submitted:859 accepted:574
[Submit] [Status] [Web Board] Description
Moves the array all elements forward one (the first element moves to the last) and then outputs the moved array
Input
Multiple sets of test data, each set
The first line enters an integer n (not greater than 20)
Enter n integers in the second line
Output
An array that moves forward one after the output
Sample Input
41 2 3 4
Sample Output
2 3 4 1
Source
0 Starting point Learning algorithm
1#include <stdio.h>2 intMain () {3 intn,a[ -],b[ -];4 while(SCANF ("%d", &n)! =EOF) {5 for(intI=0; i<n;i++){6scanf"%d",&A[i]); 7 }8 9 for(intI=1; i<n;i++){Tenb[i-1]=A[i]; One } Ab[n-1]=a[0]; - - for(intI=0; i<n-1; i++){ theprintf"%d", B[i]); - } -printf"%d\n", b[n-1]); - } + return 0; -}
1153:0 start-up algorithm 60--element forward 1 bit