hdoj1027【STL系列。。。?】

这个太夸张了。。。感觉是有别的方法,但是觉得再说吧。。。以后碰到全排列应该也是用STL嗨的吧。。。嗯,,,就是这样的。。。。?再说,再说。。
还有杭电支持c艹11,很棒

#include <bits/stdc++.h>
using namespace std;
#define LL long long
const int INF=0x3f3f3f3f;
const int MAXN=1e3+7;

int a[MAXN];

int main()
{
    int n,m,i;
    while(~scanf("%d%d",&n,&m))
    {
        memset(a,0,sizeof(a));
        for(i=1;i<=n;i++){
            a[i]=i;
        }
        m--;
        while(m--){
            next_permutation(a+1,a+n+1);
        }
        for(i=1;i<=n;i++){
            if(i!=1) printf(" ");
            printf("%d",a[i]);
        }
        puts("");
    }
    return 0;
}
原文地址:https://www.cnblogs.com/keyboarder-zsq/p/5934451.html