1 solutions
-
0
#include <iostream> using namespace std; const int MAXN = 2e3 + 5; int a[MAXN],b[MAXN],n; int main(){ cin >> n; for (int i=1;i<=n;i++) cin >> a[i]; while (true) { //先将a shift一次 //再输出 //再判断是否a[n] = n for (int i=2;i<=n;i++) b[i] = a[i-1]; b[1] = a[n]; for (int i=1;i<=n;i++) { a[i]=b[i]; printf("%d ",a[i]); } printf("\n"); if (a[n]==n) break; } }
- 1
Information
- ID
- 8101
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 1
- Tags
- # Submissions
- 84
- Accepted
- 38
- Uploaded By