Permutation Forger(思维)

https://codeforces.com/contest/1405/problem/A


根据题目相邻的反序一下就好了。倒序输出即可。

#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=200;
typedef long long LL;
LL a[maxn];
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  LL t;cin>>t;
  while(t--)
  {
  	LL n;cin>>n;
	for(LL i=1;i<=n;i++) cin>>a[i];
	for(LL i=n;i>=1;i--) cout<<a[i]<<" ";
	cout<<endl;	
  } 
return 0;
}

猜你喜欢

转载自blog.csdn.net/zstuyyyyccccbbbb/article/details/108446320
今日推荐