当前位置:   article > 正文

C++ 全排列(STL)_c++stl全排列

c++stl全排列

全排列(STL) 

  1. #include <iostream>
  2. #include <algorithm>
  3. #include <cstring>
  4. using namespace std;
  5. int main(){
  6. int t;
  7. cin >> t;
  8. while(t--){
  9. char s[100];
  10. cin >> s;
  11. int l=strlen(s);
  12. sort(s,s+l);
  13. do{
  14. for (int i = 0; i < l;i++) cout << s[i];
  15. cout << endl;
  16. }while(next_permutation(s,s+l));
  17. cout << endl;
  18. }
  19. return 0;
  20. }

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/795281
推荐阅读
相关标签
  

闽ICP备14008679号