EIUSUBSET - Subset 1

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Hà Minh Ngọc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Given a set ~A~ with ~N~ elements, generate all non-empty subsets of ~A~.

Input

  • The first line is ~N~ (~1 \leq N \leq 20~)
  • The next line contains ~N~ distinct double ~a~ elements of the set. (~1 \leq a \leq 100~)

Output

  • The first line is ~M~, the number of non-empty subsets
  • The next ~m~ lines are the subsets.

Example Input 1

3
1 2 3

Example Output 1

7
3 
2 
2 3 
1 
1 3 
1 2 
1 2 3 

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.