跳到正文

个人记录

题解14.2

a20141120liuzizheng约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年6月10日
收录
2025年12月12日
更新
2026年11月14日
篇幅
约 1 分钟

版本

  1. v1当前

移动数组

错误原因

不知道要用队列做

C++
#include<bits/stdc++.h>
using namespace std;
const int N=2e3+5;
int n,a[N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	while(1==1){
		int t=a[n];
		for(int i=n;i>=2;i--){
			a[i]=a[i-1];	
		}
		a[1]=t;
		for(int i=1;i<=n;i++){
			cout<<a[i]<<" ";
		}
    cout<<endl;
	}
	return 0;	
}
原文