题解 | #Constructive#
Constructive
https://ac.nowcoder.com/acm/contest/120561/K
由于乘法的递进比加法要快,可以判断出答案数量有限,动手写出几组数据。 当写到{1,2,3}时,可以发现后面已经没有满足要求的数据。 由此得出满足条件的数据只有{1},{1,2,3};
```#include<bits/stdc++.h>
using namespace std;
int T,n;
int main()
{
cin>>T;
while(T--)
{
cin>>n;
if(n==1)
{
cout<<"YES"<<endl<<"1"<<endl;
}
else if(n==3)
{
cout<<"YES"<<endl<<"1 2 3"<<endl;
}
else cout<<"NO"<<endl;
}
return 0;
}
查看6道真题和解析