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;
}
全部评论

相关推荐

那一天的Java_J...:他本来公司就是做这个的,不就是正常的游戏客户端和服务器开发,软硬件联动,有啥恶心不恶心的,提前告诉你就是怕你接受不了,接受不了就没必要再往后走流程浪费时间,虽然这公司是一坨。
点赞 评论 收藏
分享
ohs的小木屋:比不少实习待遇高了
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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