Description
There are n integers, so that the last m number is changed to the first m number, and the other numbers are shifted to the following m (m <n <100) position.
Input
The input data has two rows. The first number of the first row is n, followed by n integers,
The second line is an integer (m.
Output
Output n integers in sequence.
Sample Input
5 1 2 3 4 5
2
Sample output
4 5 1 2 3
[Plain] # include <stdio. h>
Int main ()
{
Int I;
Int n;
Int m;
Int num [101];
While (scanf ("% d", & n )! = EOF)
{
For (I = 0; I <n; I ++)
{
Scanf ("% d", & num [I]);
}
Scanf ("% d", & m );
For (I = n-m; I <n; I ++)
{
Printf ("% d", num [I]);
}
For (I = 0; I <n-m; I ++)
{
Printf ("% d", num [I]);
If (I <n-m-1)
{
Printf ("");
}
}
Printf ("\ n ");
}
Return 0;
}
# Include <stdio. h>
Int main ()
{
Int I;
Int n;
Int m;
Int num [101];
While (scanf ("% d", & n )! = EOF)
{
For (I = 0; I <n; I ++)
{
Scanf ("% d", & num [I]);
}
Scanf ("% d", & m );
For (I = n-m; I <n; I ++)
{
Printf ("% d", num [I]);
}
For (I = 0; I <n-m; I ++)
{
Printf ("% d", num [I]);
If (I <n-m-1)
{
Printf ("");
}
}
Printf ("\ n ");
}
Return 0;
}