Nội dung Bài tập
- Mã:
- r2.b2.Subsets
- Tên:
- Subsets
- Dạng thi:
- oi
- Thang điểm:
- 10 điểm
- Giới hạn thời gian:
- 1 giây
- Giới hạn bộ nhớ:
- 64 MB
- Được tạo bởi:
- admin
Given 2 integers set X = {x1,x2,…,xm} and Y = {y1,y2,...,yn}, with:
We called that X has smaller order than Y if:
Example with n=3:
Input
The input consists of two positive integer 1< n ≤ 60 and 1≤ k ≤260−1.
Your task is determine subset have index k of set has n elements {1,2,3,…,n}.
Output
Output sequence of positive integers separate by one space represent the subset.
Quảng cáo
x1 < x2 ... < xm
y1 < y2 ... < yn
y1 < y2 ... < yn
We called that X has smaller order than Y if:
- Exist i that x1=y1,x2=y2,…,xi−1=yi−1 ,xi < yi
- m < n and x
1=y1,x2=y2,…,xm = ym
Example with n=3:
Index |
Subset |
1 |
{1} |
2 |
{1,2} |
3 |
{1,2,3} |
4 |
{1,3} |
5 |
{2} |
6 |
{2,3} |
7 |
{3} |
Input
The input consists of two positive integer 1< n ≤ 60 and 1≤ k ≤260−1.
Your task is determine subset have index k of set has n elements {1,2,3,…,n}.
Output
Output sequence of positive integers separate by one space represent the subset.
Sample input |
Sample output |
3 2 |
1 2 |
4 9 |
2 |
Theme :
Mời bạn soạn code
Ai có thể xem bài này :
Thông tin
Phần thảo luận