Submit | All submissions | Best solutions | Back to list |
NAJAS - Amazing Subset |
Given an integer array A with N element. You have to find out how many amazing subset of A can be possible.
A set S is a subset of another set A if all elements of the set S are elements of the set A. In other words, the set S is contained inside the set A. The subset relationship is denoted as S⊂A.
A subset S called amazing subset, if product of all the element of subset is non-zero.
Assume S like that, S[1], S[2], S[3], S[4]………. S[n]
If is non-zero, then it’s called amazing subset.
And an empty set is not considered as an amazing subset.
Input:
The first line of the input contains an integer T (T<=100) denoting the number of test cases. Each test case contains an integer N (0≤N≤50) which denotes the number of element in the array A. The next line contains space-separated N integers which are elements of the array A. All elements are in -10^9 to 10^9 range.
Output:
For each case, print the case number and the number of amazing subset.
Sample:
Input |
Output |
2 |
Case 1: 31
|
Authored By: Tanvir Hasan Anick
Added by: | Najmuzzaman |
Date: | 2014-10-25 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
2018-08-24 18:41:55
There are repeating non-zero elements. |
|
2014-10-30 10:04:03 I know nothing
move to tutorial |
|
2014-10-30 10:04:03 Vamsi Krishna Avula
There are no repeated elements but repeated zeroes may be present! |
|
2014-10-30 10:04:03 Kishlay Raj
are there any repeated elements , plz mention |
|
2014-10-30 10:04:03 Sergej
Problem description: set vs. multiset ? |