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. 震惊!CSS 也能实现碰撞检测?

    本文,我们将一起学习,使用纯 CSS,实现如下所示的动画效果: 上面的动画效果,非常有意思,核心有两点: 小球随机做 X.Y 方向的直线运动,并且能够实现碰撞到边界的时候,实现反弹效果 小球在碰撞边界 ...

  2. Set Concept

    集合(Set)就是一种用来装事物的容器(或者称为结构),它所装的东西叫元素.集合这个容器的逻辑性很强,可以说是现在比较严谨的工具. 集合里的元素,它们可以是任何类型的数学对象:数字.符号.变量.空间中 ...

  3. Solution -「THUPC 2019」Duckchess

    Description Link. 大模拟是不可能给你概括题意的. Solution (据说鸭棋题解用这个标题很吉利)(这里是被点名批评的 长度 19k 的打法)(先说好代码里 Chinglish 满 ...

  4. IPv6的基本认识

    IPv6 1.IPv6的基本认识 IPv4 位数是 32位,4字节,能够提供的IP地址大约是42亿,但你知道的,如今一个人都不止一个IP地址,看看如今设备的数量及发展速度就知道,所以有了IPv6,IP ...

  5. 打造炫酷效果:用Java优雅地制作Excel迷你图

    摘要:本文由葡萄城技术团队原创并首发.转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者. 前言 迷你图是一种简洁而有效的数据可视化方式,常用于展示趋势和变化.它 ...

  6. 下载kubernetes

    前言 页面介绍了k8s的组件下载的方法 二进制文件 二进制文件的下载链接在CHANGELOG文件中,这里有一个技巧是直接下载Server Binaries,这个是包含了所有的二进制文件.下载后记得比对 ...

  7. Unity禁止C#自动编译

    基于unity2017\2020版本 using System; using System.Linq; using System.Reflection; using UnityEditor; usin ...

  8. Java 基础学习第一弹

    1. equels和==的区别 equals方法用于比较对象的内容是否相等,可以根据自定义的逻辑来定义相等的条件,而==操作符用于比较对象的引用是否相等,即它们是否指向同一块内存地址.equals方法 ...

  9. 搓一个Pythonic list

      总所周知,Python语言当中的list是可以存储不同类型的元素的,对应到现代C++当中,可以用std::variant或者std::any实现类似的功能.而Python官方的实现当中用到了二级指 ...

  10. RLHF · PBRL | RUNE:鼓励 agent 探索 reward model 更不确定的 (s,a)

    论文题目: Reward uncertainty for exploration in preference-based reinforcement learning,是 ICLR 2022 的文章, ...