Processing math: 100%
祝同学们学习进步,编程快乐!
Problem 2643 --Bitset II - Enumeration of Subsets I

2643: Bitset II - Enumeration of Subsets I

"
Time Limit 1 秒/Second(s) Memory Limit 512 兆字节/Megabyte(s)
提交总数 5 正确数量 4
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL

Enumeration of Subsets I

Print all subsets of a set SS, which contains 0,1,...n10,1,...n−1 as elements. Note that we represent 0,1,...n10,1,...n−1 as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary respectively and the integer representation of a subset is calculated by bitwise OR of existing elements.

Input

The input is given in the following format.

nn

Output

Print subsets ordered by their decimal integers. Print a subset in a line in the following format.

dd: e0e0 e1e1 ... 

Print ':' after the integer value dd, then print elements eiei in the subset in ascending order. Seprate two adjacency elements by a space character.

4
0:
1: 0
2: 1
3: 0 1
4: 2
5: 0 2
6: 1 2
7: 0 1 2
8: 3
9: 0 3
10: 1 3
11: 0 1 3
12: 2 3
13: 0 2 3
14: 1 2 3
15: 0 1 2 3
  • 1n18

推荐代码 查看2643 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[183 ms] AOJ大管家 437039 2019-06-07 13:03:22
内存最少[1704 KB] Qiqy 609172 2020-08-02 11:56:32
第一AC 计爱玲 362671 2019-01-30 16:13:43
第一挑战 计爱玲 362670 2019-01-30 16:12:08

赛题来源/所属竞赛 会津大学《C++ Programming II》 C++程序设计(高级)

竞赛编号 竞赛名称 竞赛时间 访问比赛
AOJ
祝同学们学习进步,编程快乐!