标签:using nbsp == long array pac cout int lse
#include<bits/stdc++.h>
#define ll long long
using namespace std;
//按照题意可知二分之n为偶数的时候存在这样的数组,按照题意分两部分存入数组即可
int main()
{
ll t,n;
cin>>t;
for(int i=0; i<t; i++)
{
cin>>n;
if(n/2%2==0)
{
ll a[n+1];
ll s=0,k=1;
for(int j=1; j<=n/2; j++)
{
a[j]=j*2;
s+=a[j];
}
for(int j=n/2+1;j<n;j++)
{
a[j]=k;
s-=k;
k+=2;
}
a[n]=s;
cout<<"YES"<<endl;
for(int j=1;j<=n;j++)
{
cout<<a[j]<<" ";
}
cout<<endl;
}
else
{
cout<<"NO"<<endl;
}
}
}
标签:using nbsp == long array pac cout int lse
原文地址:https://www.cnblogs.com/SyrupWRLD999/p/12941475.html