题解 | 小红的方神题

小红的方神题

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")

全部评论

相关推荐

04-15 13:42
四川大学 Java
蹲蹲offerrr:快投吧,有点晚现在
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务