题解 | #全排列#

全排列

https://www.nowcoder.com/practice/5632c23d0d654aecbc9315d1720421c1

#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
vector<string> store;
void wholesort(string pre,string x){
    if(x.length()==1){
        cout<<pre+x<<endl;
    }
    for(int i=0;i<x.length();i++){
        string nextpre;
        string nextx=x.substr(0,i)+x.substr(i+1);
        nextpre=pre+x[i];
        wholesort(nextpre, nextx);
    }
}
int main() {
    string x;
    while(cin>>x){
        wholesort("", x);

    }
}

全部评论

相关推荐

淬月星辉:专利是什么?至少描述一下吧,然后把什么计算机二级、普通话这种拉低格调的证书删掉,不然hr以为你没东西写
点赞 评论 收藏
分享
10-14 12:20
门头沟学院 Java
迷茫的大四🐶:摊牌了,我是25届的,你们也不招我
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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