杭电oj刷题(2062)

这是一道关于杭电在线判题系统(OJ)中编号为2062的题目,涉及排序和子序列的概念。题目要求找到集合{1, 2, ..., n}的所有非空子序列,并按字典序排序,然后输出第m个子序列。" 84976920,5738462,Java类加载机制:双亲委派模型详解,"['JVM', '类加载器', 'Java编程']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Subset sequence(难理解)

题目描述:

Consider the aggregate An= { 1, 2, …, n }. For example, A1={1}, A3={1,2,3}. A subset sequence is defined as a array of a non-empty subset. Sort all the subset sequece of An in lexicography order. Your task is to find the m-th one.

Input

The input contains several test cases. Each test case consists of two numbers n and m ( 0< n<= 20, 0< m<= the total number of the subset sequence of An ).

Output

For each test case, you should output the m-th subset sequence of An in one line.

Sample Input

1 1 
2 1 
2 2 
2 3 
2 4 
3 10

Sample Output

1 
1 
1 2 
2 
2 1 
2 3 1

通过答案:

#include<stdio.h>
int main()
{
    int n,i,group;
    int s[21];        //每组首字母 
    __int64 m; 
    __int64 c[21]={0};     //每组个
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值