题解 | 小红的方神题
小红的方神题
https://www.nowcoder.com/practice/655d31e0d4c84eed8853b90d49e35113
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
if(n==1||n==2)cout<<-1<<endl;
else {
cout<<n<<" ";
for(int i=1;i<n;i++){
cout<<i<<" ";
}
}
return 0;
}//一开始想要用next_permutation();之后想构造,还得找规律
// 64 位输出请用 printf("%lld")

查看2道真题和解析