码迷,mamicode.com
首页 > 其他好文 > 详细

STL next_permutation 全排列

时间:2018-02-20 16:22:08      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:pos   方法   分享图片   while   color   全排列   alt   ++   bubuko   

调用方法:

    int arr[4]={1,2,3,4};
    while(next_permutation(arr,arr+4)){
        for(int i=0;i<4;i++)
            printf("%d ",arr[i]);
        puts("");
    }

测试效果:

技术分享图片

注:可以看到1 2 3 4这个结果被跳过了。

 

STL next_permutation 全排列

标签:pos   方法   分享图片   while   color   全排列   alt   ++   bubuko   

原文地址:https://www.cnblogs.com/TQCAI/p/8455316.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!