NAJAS - Amazing Subset

no tags 

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
5
1 2 3 4 5
5
-1 1 -2 -3 5

Case 1: 31
Case 2: 31

 

 

Authored By: Tanvir Hasan Anick


hide comments
nadstratosfer: 2018-08-24 18:41:55

There are repeating non-zero elements.

I know nothing: 2014-10-30 10:04:03

move to tutorial

Vamsi Krishna Avula: 2014-10-30 10:04:03

There are no repeated elements but repeated zeroes may be present!

Kishlay Raj: 2014-10-30 10:04:03

are there any repeated elements , plz mention

Sergej: 2014-10-30 10:04:03

Problem description: set vs. multiset ?


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