jjj
2023-10-31 20:52:00
发布于:上海
11阅读
0回复
0点赞
#include<iostream>
using namespace std;
int main()
{
int a[10001],n,t,zh,i=0;
cin>>t;
for(int y=1;y<=t;y++)
{
zh=1;
a[10001]={};
cin>>n;
i=n;
for(int y=1;y<=n;y++)
{
cin>>a[y];
}
if(n%2==0)
{
for(int y=1;y<=n/2;y++)
{
cout<<a[zh]<<" ";
cout<<a[i]<<" ";
zh=zh+1;
i=i-1;
}
}
else
{
for(int y=1;y<=(n-1)/2;y++)
{
cout<<a[zh]<<" ";
cout<<a[i]<<" ";
zh=zh+1;
i=i-1;
}
cout<<a[n/2+1];
}
cout<<endl;
}
return 0;
}
这里空空如也
有帮助,赞一个