D - Balloons (SDUT 2018 Autumn Individual Contest - I)

滴答滴答---题目链接

In many contests, balloons are used to indicate to contestants the general state of the contest. Each time a team solves a problem, a balloon of a specific color is sent to the team and attached on or near their machine. As the contest progresses, the contest floor gradually fills up with a multi-colored display showing how various teams are doing in the contest.

Consider a contest of n problems in which each problem is attached to a specific balloon color. You will be able to see the balloon color of a problem in the contest floor if at least one team solved it during the contest.

You are given the number of accepted solutions on each problem. Your task is to count how many different colors you will be able to see. Can you?

Input

The first line contains an integer T (1 ≤ T ≤ 1000), in which T is the number of test cases.

The first line of each test case contains an integer n (1 ≤ n ≤ 20), in which n is the number of problems in the contest.

Then a line follows containing n integers p1, p2, ..., pk (0 ≤ pi ≤ 100), in which pi is the number of accepted solutions on the ithproblem.

Output

For each test case, print a single line containing the number different colors will you be able to see in the contest's floor.

Example

Input

3
4
5 7 2 1
3
1 0 1
5
4 0 1 0 3

Output

4
2
3
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int ans=0;
        for(int i=1; i<=n; i++)
        {
            int x;
            cin>>x;
            if(x!=0)ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值