Notes

For two integer sequences of the same length $A_1,A_2,\dots,A_N$ and $B_1,B_2,\dots,B_N$, $A$ is said to be lexicographically earlier than $B$ if and only if:

  • there is an integer $i$ $(1 \le i \le N)$ such that $A_j=B_j$ for all integers $j$ satisfying $1 \le j < i$, and $A_i < B_i$.

An integer sequence $A_1,A_2,\dots,A_N$ is said to be strictly increasing if and only if:

  • $A_i < A_{i+1}$ for all integers $i$ $(1 \le i \le N-1)$.

Constraints

  • $1 \le N \le M \le 10$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$ $M$

Output

Print the sought sequences in lexicographically ascending order, each in its own line (see Sample Outputs).


Sample Input 1

2 3

Sample Output 1

1 2
1 3
2 3

The sought sequences are $(1,2),(1,3),(2,3)$, which should be printed in lexicographically ascending order.


Sample Input 2

3 5

Sample Output 2

1 2 3
1 2 4
1 2 5
1 3 4
1 3 5
1 4 5
2 3 4
2 3 5
2 4 5
3 4 5

爆搜出所有符合要求的排列。

#include<cstdio>
int n,m,st[15];
void dfs(int x,int lst)
{
if(x>n)
{
for(int i=1;i<=n;i++)
printf("%d ",st[i]);
putchar('\n');
return;
}
for(int i=lst+1;i<=m;i++)
{
st[x]=i;
dfs(x+1,i);
}
}
int main()
{
scanf("%d%d",&n,&m);
dfs(1,0);
}

[ABC263C] Monotonically Increasing的更多相关文章

  1. Application provided invalid, non monotonically increasing dts to muxer in stream

    很多同学在使用Ffmpeg过程中都遇到Application provided invalid, non monotonically increasing dts to muxer in stream ...

  2. Data Structure Array: Longest Monotonically Increasing Subsequence Size

    http://www.geeksforgeeks.org/longest-monotonically-increasing-subsequence-size-n-log-n/ #include < ...

  3. [LeetCode] Design Hit Counter 设计点击计数器

    Design a hit counter which counts the number of hits received in the past 5 minutes. Each function a ...

  4. iOS 时间的处理

    做App避免不了要和时间打交道,关于时间的处理,里面有不少门道,远不是一行API调用,获取当前系统时间这么简单.我们需要了解与时间相关的各种API之间的差别,再因场景而异去设计相应的机制. 时间的形式 ...

  5. Apache Kafka – KIP 32,33 Time Index

    32, 33都是和时间相关的, KIP-32 - Add timestamps to Kafka message 引入版本,0.10.0.0 需要给kafka的message加上时间戳,这样更方便一些 ...

  6. LeetCode Design Hit Counter

    原题链接在这里:https://leetcode.com/problems/design-hit-counter/. 题目: Design a hit counter which counts the ...

  7. Leetcode: Sort Transformed Array

    Given a sorted array of integers nums and integer values a, b and c. Apply a function of the form f( ...

  8. linux 时间管理——概念、注意点(一)【转】

    转自:http://www.cnblogs.com/openix/p/3324243.html 参考:1.http://bbs.eyeler.com/thread-69-1-1.html        ...

  9. Codeforces Round #371 (Div. 1)

    A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...

  10. Interpolation in MATLAB

    Mathematics     One-Dimensional Interpolation There are two kinds of one-dimensional interpolation i ...

随机推荐

  1. 开源Word文字替换小工具更新 增加文档页眉和页脚替换功能

    ITGeeker技术奇客发布的开源Word文字替换小工具更新到v1.0.1.0版本啦,现已支持Office Word文档页眉和页脚的替换. 同时ITGeeker技术奇客修复了v1.0.0.0版本因替换 ...

  2. Hadoop NameNode启动后自动关闭解决方法

    Hadoop NameNode启动后过一会自动关闭了,查看日志文件报内存溢出异常: tail -100 /bigdata/logs/hadoop/hadoop-root-namenode-node1. ...

  3. # 简明快速配置 Rust 工具链

    以下内容为本人的学习笔记,如需要转载,请声明原文链接微信公众号「ENG八戒」https://mp.weixin.qq.com/s/dBzL9WZ8P1L1X9j_XkmNQg 你可能会为不同版本的工具 ...

  4. Note -「Suffix Automaton」SAM

    Part. 1 基本信息 Part. 1-1 SAM 的构成. SAM 由两个东西构成,一个是一个 DAWG,还有一棵外向树,叫 parent tree. 比如,给你一个字符串 \(S=\sf abb ...

  5. 浅入深出的微前端MicroApp

    前言: 本文是由最近做的一个项目有感而发,因为之前做了一些技术栈的统一,为了用ant Design的pro-table,PC统一使用react,但是我们有一些老的项目是vue的,本次新页面较多,老页面 ...

  6. 文章《Semantic Kernel &mdash;&mdash; LangChain 的替代品?》的错误和疑问 探讨

    微信公众号文章 Semantic Kernel -- LangChain 的替代品?[1] ,它使用的示例代码是Python ,他却发了这么一个疑问: 支持的语言对比(因为 Semantic Kern ...

  7. 爬虫系列——selenium

    文章目录 一 介绍 二 安装 三 基本使用 四 选择器 五 等待元素被加载 六 元素交互操作 七 其他 八 项目练习 一 介绍 selenium最初是一个自动化测试工具,而爬虫中使用它主要是为了解决r ...

  8. CSE 2023 混合年度回声周末

    CSE 2023 混合年度回声周末(2023 年 4 月 13 日至 15 日)25 周年银周年纪念版 近 900 名参与者参加.又是成功的伟大一年.明年 2024 年 4 月在多伦多见.敬请关注全年 ...

  9. [ABC205E] White and Black Balls 题解

    White and Black Balls 题目大意 将 \(n\) 个白球,\(m\) 个黑球排成一列,要求满足 \(\forall i\in[1,n+m],w_i\le b_i+k\),问存在多少 ...

  10. 「CSP-2023」我曾璀璨星空,星月相伴,致远方,致过往。

    Day -1   像往常一样去上学.虽然身在学校但感觉心还在比赛上.在一个上午课间准备去上厕所时遇见了信息老师.她在教我们班信息之前我的一些奖状的指导教师就是写的她,之前就认识了,每次碰到她都会朝我笑 ...