STL解法

老子的全排列呢

https://ac.nowcoder.com/acm/problem/15128

STL解法

#include<bits/stdc++.h>
using namespace std;

int main()
{
    vector<int> test(8);
    for(int i=0; i<8; ++i)
    {
        test[i]=i+1;
    }

    do
    {
        for(int i=0; i<8; ++i)
        {
            if( 7!=i )
            {
                printf("%d ",test[i]);
            }
            else
            {
                printf("%d\n",test[i]);
            }
        }

    }while( next_permutation( test.begin(), test.end()) );


    return 0;
}
全部评论

相关推荐

2024-12-25 09:09
四川师范大学 运营
想和你交朋友的潜伏者要冲国企:先去沃尔玛亲身感受标准化流程体系,一两年后再跳槽国内任何零售行业,可以有更大选择权吧?
点赞 评论 收藏
分享
2024-12-27 13:08
华南理工大学 Java
蝴蝶飞出了潜水钟丿:多看一眼就会💥
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务