[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 ...
随机推荐
- 文心一言 VS 讯飞星火 VS chatgpt (79)-- 算法导论7.4 4题
四.请用go语言,证明:RANDOMIZED-QUICKSORT 期望运行时间是 Ω(nlgn). 文心一言: 首先,为了证明RANDOMIZED-QUICKSORT的期望运行时间是Ω(nlg n), ...
- 前端Vue仿企查查 天眼查知识产权标准信息列表组件
引入Vue仿企查查天眼查知识产权标准信息列表组件 随着技术的不断发展,传统的开发方式使得系统的复杂度越来越高.在传统开发过程中,一个小小的改动或者一个小功能的增加可能会导致整体逻辑的修改,造成牵一 ...
- 用OLED屏幕播放视频(1): 项目介绍
下面的系列文章记录了如何使用一块linux开发扳和一块OLED屏幕实现视频的播放: 项目介绍 为OLED屏幕开发I2C驱动 使用cuda编程加速视频处理 这篇文章主要对项目的实现做整体的介绍, 包括硬 ...
- 10款Visual Studio实用插件
前言 俗话说的好工欲善其事必先利其器,安装一些Visual Studio实用插件对自己日常的开发和工作效率能够大大的提升,避免996从选一款好的IDE实用插件开始.以下是我认为比较实用的Visual ...
- IOS苹果应用IPA一键签名工具(苹果重签名,企业签名,Windows平台,时间控制)
苹果应用IPA一键签名工具可以在windows平台对苹果应用IPA文件重新签名,无需MAC苹果电脑和配置XCODE开发环境,便可以直接对IPA文件进行签名,同时支持修改BundleID, 不受描述文件 ...
- Kruskal重构树 学习笔记
Kruskal 重构树 最大生成树将部分内容倒置即可 回顾:Kruskal 基本信息 求解最小生成树 时间复杂度:\(O(m \log m)\) 更适合稀疏图 算法思想 按照边权从小到大排序 依次枚举 ...
- BY组态-低代码web可视化组件
简介 BY组态是贵州九元四方科技完全自主研发的集实时数据展示.动态交互等一体的全功能可视化平台.帮助物联网.工业互联网.电力能源.水利工程.智慧农业.智慧医疗.智慧城市等场景快速实现数字孪生.大屏可视 ...
- open与fopen的区别
1. 来源 从来源的角度看,两者能很好的区分开,这也是两者最显而易见的区别: open是UNIX系统调用函数(包括LINUX等),返回的是文件描述符(File Descriptor),它是文件在文件描 ...
- 汇编debug的安装
实验一查看CPU和内存,用机器指令和汇编指令编程 在做实验前需要debug命令. 工具:dosbox,debug.exe 安装:dosbox :https://www.dosbox.com/ debu ...
- PostgreSQL学习笔记-7.基础知识:子查询、自增、PRIVILEGES 权限
子查询 子查询或称为内部查询.嵌套查询,指的是在 PostgreSQL 查询中的 WHERE 子句中嵌入查询语句.一个 SELECT 语句的查询结果能够作为另一个语句的输入值.子查询可以与 SELEC ...