Sunday, June 19, 2022

Award Ceremony

 

1. There should be at least a participant getting a reward.

2. Participants who scored 0 should not get any rewards.

3. All participants who scored more than or equal to the minimum score decided should get rewarded.

Your task is to calculate the number of ways to get a subset of participants who will receive a reward.

Example:
Input: ‘N’ = 5 and ‘ARR’ = [1, 2, 3, 1, 0]
Output: 3
Explanation: There are three ways to select a subset:

A: 3rd participant will get a reward. When minimum score to get a reward is 3.

B: 2nd and 3rd participants will get rewards. When minimum score to get a reward is 2.

C: 1st, 2nd, 3rd, and 5th participants will get rewards. When minimum score to get a reward is 1.
Input Format :
The first line of input contains an integer ‘T’, denoting the number of test cases. 

The first line of each test case contains the integer ‘N’.

The second line contains ‘N’ space-separated integers denoting the elements of array ‘ARR’.
Output Format :
For each test case, print an integer denoting the number of ways to get a subset of participants who will receive a reward.

Print the output of each test case in a new line.
Note :
You don’t need to print anything. It has already been taken care of. Just implement the given function.
Constraints :
1 <= ‘T’ <= 10
1 <= ‘N’ <= 10^4
0 <= ‘ARR[i]’ <= 10^18

Time Limit: 1 sec
Sample Input 1 :
2
2
0 2
3
2 3 3 
Sample Output 1 :
1
2
Explanation Of Sample Input 1 :
In the first test case, there is only a single possibility by which we can reward the contestants and it can be done by rewarding the 2nd contestant. Hence, the output is 1.

In the second test case, we can give rewards in 2 ways i.e., by giving them to 2nd and 3rd contestants or by providing rewards to all the three contestants. Hence, the output is 2.
Sample Input 2 :
2
1
100     
4
1 1 1 1
Sample Output 2 :
1
1
Explanation Of Sample Input 2 :
In the first test case, there is only a single contestant. Hence, the output is 1.

In the second test case, we will be giving rewards to all four contestants. Hence, the output is 1.

No comments:

Post a Comment

मुझे दिल में बसाना आसान नहीं....

पता है Recently i realised की मुझे दिल में बसाना आसान नहीं है बात-बात पे चिढ़ जाती हूं मैं दिल लगा लूं एक बार तो फिर ज़िद पे अड़...