You know in advance all the orders which will have to be processed by the stores manager today, but you do not know their booking order. Compute all possible ways of the visits of warehouses for the stores manager to settle all the demands piece after piece during the day.
bbjd
bbdj
bbjd
bdbj
bdjb
bjbd
bjdb
dbbj
dbjb
djbb
jbbd
jbdb
jdbb
首先排个序,从小到大,然后直接调用stl中的全排列函数,就可以得到所有全排列
code:
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> using namespace std; int main(){ string s; cin >> s; sort(s.begin(),s.end()); do{ cout << s << endl; }while(next_permutation(s.begin(),s.end())); return 0; }
804


&spm=1001.2101.3001.11974&articleId=78447964&d=1&t=3&u=a556ecf4c62147fc93d21a88fea461b7)

被折叠的 条评论
为什么被折叠?



