zoukankan      html  css  js  c++  java
  • POJ 1833 生成排列

    题目链接:POJ 1833

    /************************************
    *              author        :  Grant Yuan
    *              time            :   2014/10/19 16:38
    *              source        :   POJ 1833
    *              algorithm:    STL+排列的生成
    *************************************/
    #include <iostream>
    #include <algorithm>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    using namespace std;
    int str[1030];
    int ans[1030];
    int n,k,t;
    int main()
    {
       scanf("%d",&t);
        while(t--){
            memset(str,0,sizeof(str));
            scanf("%d%d",&n,&k);
            for(int i=0;i<n;i++)
            {
                scanf("%d",&str[i]);
            }
            for(int i=1;i<=k;i++)
            {
                    bool b=next_permutation(str,str+n);
            }
          for(int j=0;j<n;j++)
            {
                  if(j!=n-1)  printf("%d ",str[j]);
                   else printf("%d
    ",str[j]);
            }
        }
        return 0;
    }
    


  • 相关阅读:
    linxu 网络管理
    Linux 命令2
    crontab命令
    Linux 命令
    Linux 命令
    Git命令
    GIT
    Python 修改文件内容
    logging模块
    CSS 选择器
  • 原文地址:https://www.cnblogs.com/llguanli/p/7181406.html
Copyright © 2011-2022 走看看