[ABC263C] Monotonically Increasing
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的更多相关文章
- Application provided invalid, non monotonically increasing dts to muxer in stream
很多同学在使用Ffmpeg过程中都遇到Application provided invalid, non monotonically increasing dts to muxer in stream ...
- Data Structure Array: Longest Monotonically Increasing Subsequence Size
http://www.geeksforgeeks.org/longest-monotonically-increasing-subsequence-size-n-log-n/ #include < ...
- [LeetCode] Design Hit Counter 设计点击计数器
Design a hit counter which counts the number of hits received in the past 5 minutes. Each function a ...
- iOS 时间的处理
做App避免不了要和时间打交道,关于时间的处理,里面有不少门道,远不是一行API调用,获取当前系统时间这么简单.我们需要了解与时间相关的各种API之间的差别,再因场景而异去设计相应的机制. 时间的形式 ...
- Apache Kafka – KIP 32,33 Time Index
32, 33都是和时间相关的, KIP-32 - Add timestamps to Kafka message 引入版本,0.10.0.0 需要给kafka的message加上时间戳,这样更方便一些 ...
- LeetCode Design Hit Counter
原题链接在这里:https://leetcode.com/problems/design-hit-counter/. 题目: Design a hit counter which counts the ...
- 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( ...
- linux 时间管理——概念、注意点(一)【转】
转自:http://www.cnblogs.com/openix/p/3324243.html 参考:1.http://bbs.eyeler.com/thread-69-1-1.html ...
- Codeforces Round #371 (Div. 1)
A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...
- Interpolation in MATLAB
Mathematics One-Dimensional Interpolation There are two kinds of one-dimensional interpolation i ...
随机推荐
- 【LaTeX】基础介绍
目录 TeX 和 LaTeX pdfTeX.XeTeX 和 LuaTeX 三者的介绍 各自的特性 参考资料 TeX 和 LaTeX Tex 是一个排版软件,而 LaTeX 是基于 TeX 开发的排版系 ...
- Pycharm包推荐|自动检查shell脚本问题的包
如图,这个包自动会检测出哪块代码编写有问题,自动提示,这里可以根据提示进行修改,快速高效!!! 包的名字如图:Shell script formatter 太香了
- Sermant类隔离架构:解决JavaAgent场景类冲突的实践
本文分享自华为云社区<Sermant类隔离架构解析--解决JavaAgent场景类冲突的实践>,作者:华为云开源. Sermant是基于Java字节码增强技术的无代理服务网格,其利用Jav ...
- window操作系统安装多个版本nodejs版本-控制工具nvm
参考: https://blog.csdn.net/m0_38134431/article/details/118388297 https://juejin.cn/post/7044890876631 ...
- 支持JDK19虚拟线程的web框架,之三:观察运行中的虚拟线程
欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos 本篇概览 本篇是<支持JDK19虚拟线程的web ...
- Journey / Solution Set - 「NOIP-S 2020」「Prob. A-C」
这种东西怎么写啊... Day 1(好像也没有 Day 2 到了 NK 后发现正好可以进门,于是就什么也没有检查的进去了. 进门前问了一下 LYC 之前问过的一个问题,他说没有头绪,然后就没怎么说话了 ...
- pandas处理大数据题目的操作
1.用法:DataFrame.drop(labels=None, axis=0, index=None, columns=None, inplace=False) 2.参数说明: labels:要删除 ...
- Vue2系列(lqz)——6-Vue-cli、7-Vue插件、8-Vue第三方框架之ElementUi
文章目录 6 Vue-CLI 项目搭建 1 单文件组件 2 Vue-CLI 项目搭建 2.1 环境搭建 2.2 项目的创建 创建项目 启动/停止项目 打包项目 package.json中 2.3 认识 ...
- JNI编程之java层和native层的数组数据的交互
一.前言 JNI中的数组类型分为基本类型数组和引用类型数组,他们的处理方式是不一样的.基本类型数组中的元素都是jni基本数据类型,可以直接访问:但是引用类型的数组中的元素是一个类的实例,不能直接访问, ...
- react 16.3生命周期更新解析
React v16.3虽然是一个小版本升级,但是却对React组件生命周期函数有巨大变化. 文章梗概 新版本+2-3个生命周期. 为什么增加那2个生命周期? 为什么减去之前3个生命周期? 相关知识延伸 ...