/*
    Name: NYOJ--19--擅长排列的小明
    Date: 20/04/17 11:06
    Description: 这道题可以DFS,然而用next_permutation更简单些
                主要是全排列,将所有字符串考虑到后,只输出前m个字符
*/
#include<bits/stdc++.h>
#include<cstdlib>
using namespace std;
] = {,,,,,,,,};
int main(){
//    freopen("in.txt","r",stdin);
    ios::sync_with_stdio(false);
    int N;cin>>N;
    while(N--){
        int n,m;
        cin>>n>>m;
        string str = "";
        ;i<n;++i)str+='+arr[i];
        ,m);
        cout<<str2<<endl;
        while(next_permutation(str.begin(),str.end())){
            ,m))!= str2){
                str2 = str.substr(,m);
                cout<<str2<<endl;
            }
        }
    }
    ;
}

NYOJ--19--next_permutation()--擅长排列的小明的更多相关文章

  1. nyoj 19 擅长排列的小明(深搜,next_permutation)

    擅长排列的小明 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 小明十分聪明,而且十分擅长排列计算.比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想 ...

  2. nyoj 19擅长排列的小明 (DFS)

    擅长排列的小明 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 小明十分聪明,而且十分擅长排列计算.比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想 ...

  3. nyoj 题目19 擅长排列的小明

    擅长排列的小明 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 小明十分聪明,而且十分擅长排列计算.比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想 ...

  4. nyist oj 19 擅长排列的小明(dfs搜索+STL)

    擅长排列的小明 时间限制:1000 ms  |  内存限制:65535 KB 难度:4 描写叙述 小明十分聪明.并且十分擅长排列计算.比方给小明一个数字5,他能立马给出1-5按字典序的全排列,假设你想 ...

  5. NYOJ 469 擅长排列的小明 II

    擅长排列的小明 II 时间限制:1000 ms  |  内存限制:65535 KB 难度:3   描述 小明十分聪明,而且十分擅长排列计算. 有一天小明心血来潮想考考你,他给了你一个正整数n,序列1, ...

  6. ACM 擅长排列的小明

    擅长排列的小明 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 小明十分聪明,而且十分擅长排列计算.比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想 ...

  7. 擅长排列的小明 II(找规律)

    擅长排列的小明 II 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述 小明十分聪明,而且十分擅长排列计算. 有一天小明心血来潮想考考你,他给了你一个正整数n,序列1,2, ...

  8. nyoj_19_擅长排列的小明_201403011600

    擅长排列的小明时间限制:1000 ms  |  内存限制:65535 KB 难度:4描述 小明十分聪明,而且十分擅长排列计算.比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想为难他, ...

  9. NYOJ469 - 擅长排列的小明 II - (dp)

    题目描述: 小明十分聪明,而且十分擅长排列计算. 有一天小明心血来潮想考考你,他给了你一个正整数n,序列1,2,3,4,5......n满足以下情况的排列: 1.第一个数必须是1 2.相邻两个数之差不 ...

随机推荐

  1. [leetcode-561-Array Partition I]

    Given an array of 2n integers, your task is to group these integers into n pairs of integer,say (a1, ...

  2. 【LeetCode】105 & 106. Construct Binary Tree from Inorder and Postorder Traversal

    题目: Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume ...

  3. 1.如何安装matlab2016a

    下载:见网盘 安装教程: 解压安装文件,安装文件为 iso 格式,但是不能通过虚拟光驱安装,需要将 iso 文件用解压软件解压.注意,R2016b_win64_dvd1.iso 和 R2016b_wi ...

  4. SequoiaDB x Spark 新主流架构引领企业级应用

    6月,汇集当今大数据界精英的Spark Summit 2017盛大召开,Spark作为当今最炙手可热的大数据技术框架,向全世界展示了最新的技术成果.生态体系及未来发展规划. 巨杉作为业内领先的分布式数 ...

  5. touchmover 手机端拖动方法

    function drag(obj, parentNode) { var obj = document.getElementById(obj); if (arguments.length == 1) ...

  6. pdf文件之itextpdf操作实例

    需求分析 1.需要创建一个pdf文件,包含文件的基本属性 2.文件需要包含附件,通过点击链接直接打开 3.生成的pdf文件不能直接修改(需要输入密码) 4.pdf文件需要有文字或图片水印 准备jar包 ...

  7. Ext ApplicationController&ref的使用

    Ext ApplicationController&ref的使用 Ext.define('app.controller.ApplicationController', { //继承 Ext.a ...

  8. Spring Security Filter详解

    Spring Security Filter详解 汇总 Filter 作用 DelegatingFilterProxy Spring Security基于这个Filter建立拦截机制 Abstract ...

  9. 51Nod 1509加长棒

    传送门 http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1509 现在有三根木棒,他们的长度分别是a,b,c厘米.你可以对他 ...

  10. Codeforces Round #371 (Div. 2) 转换数字

    C. Sonya and Queries time limit per test 1 second memory limit per test 256 megabytes input standard ...