解题思路:
注意事项:
参考代码:
#include<iostream>
using namespace std;
int main()
{
int a[100], total,move,b[100];
cin >> total;
for (int i = 0;i < total;i++)
{
cin >> a[i];
}
cin >> move;
for (int i = 0;i < move;i++)
{
b[i] = a[total - move + i];
}
for (int i = total;i >=move;i--)
{
a[i] = a[i - move];//往前移两个位置
}
for (int i = 0;i < move;i++)
{
a[i] = b[i];
}
for (int i = 0;i < total;i++)
cout << a[i] << " ";
return 0;
}
0.0分
0 人评分