Given a set of positive integers, count the number of such that
where 0 < ≤ 30 and 0 < ≤1012. Please generate all such .
The input consists of multiple datasets, followed by a line which contains only a single ‘.’ (period). Each dataset is an array of unsigned integers. The array is enclosed by {} and any two adjacent unsigned integers of the array are separated with a space.
For each input dataset, print “No such subset” if the input set contains no subsets which meet the criterion. If the input set can be divided into desired subsets, print the number of such subsets first and then print each of those subsets. Print the subsets sorted with number of elements and values of smallest elements in ascending order (subset with fewer elements printed first, and if number of elements are equal, compare the subsequent successor elements). Each subset is enclosed by {} and printed in one line and any two adjacent positive integers in the subset are separated with a space, with elements in increasing order. Each case is separated with a blank line. Follow the format of the sample output.
範例輸入 1
{1 2 3 4 5 6 7}
{1 3 5 7 12}
.
範例輸出 1
8 subsets.
{1 6 7}
{2 5 7}
{3 4 7}
{3 5 6}
{1 2 4 7}
{1 2 5 6}
{1 3 4 6}
{2 3 4 5}
No such subset
Pro 專屬功能: 查看這題在歷屆 CPE 出現過幾次 — 升級以解鎖.