102841: [AtCoder]ABC284 B - Multi Test Cases

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

In this problem, an input file contains multiple test cases.
You are first given an integer $T$. Solve the following problem for $T$ test cases.

  • We have $N$ positive integers $A_1, A_2, ..., A_N$. How many of them are odd?

Constraints

  • $1 \leq T \leq 100$
  • $1 \leq N \leq 100$
  • $1 \leq A_i \leq 10^9$
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format, where $\text{test}_i$ represents the $i$-th test case:

$T$
$\text{test}_1$
$\text{test}_2$
$\vdots$
$\text{test}_T$

Each test case is in the following format:

$N$
$A_1$ $A_2$ $\dots$ $A_N$

Output

Print $T$ lines. The $i$-th line should contain the answer for the $i$-th test case.


Sample Input 1

4
3
1 2 3
2
20 23
10
6 10 4 1 5 9 8 6 5 1
1
1000000000

Sample Output 1

2
1
5
0

This input contains four test cases.

The second and third lines correspond to the first test case, where $N = 3, A_1 = 1, A_2 = 2, A_3 = 3$.
We have two odd numbers in $A_1$, $A_2$, and $A_3$, so the first line should contain $2$.

Input

题意翻译

本题有多组测试数据。 第一行一个正整数 $T (1 \leq T \leq 100)$,表示测试数据的组数。 对于每组测试数据: 第一行一个正整数 $N (1 \leq N \leq100)$ 。 第二行给定一个序列,$A_1 , A_2 ... A_n$ ($ 1 \leq A_i \leq 10^9$)。 输出: 每行一个正整数,表示第 $i$ 组测所给出的序列中,奇数有多少个。 translate by [ChrisWangZi](https://www.luogu.com.cn/user/637180)

Output

分数:200分

问题描述

在这个问题中,输入文件包含多个测试用例。

  • 首先给出一个整数$T$。为$T$个测试用例解决以下问题。

约束条件

  • $1 \leq T \leq 100$
  • $1 \leq N \leq 100$
  • $1 \leq A_i \leq 10^9$
  • 输入中的所有值都是整数。

输入

输入从标准输入以以下格式给出,其中$\text{test}_i$表示第$i$个测试用例:

$T$
$\text{test}_1$
$\text{test}_2$
$\vdots$
$\text{test}_T$

每个测试用例的格式如下:

$N$
$A_1$ $A_2$ $\dots$ $A_N$

输出

输出$T$行。第$i$行应包含第$i$个测试用例的答案。


样例输入1

4
3
1 2 3
2
20 23
10
6 10 4 1 5 9 8 6 5 1
1
1000000000

样例输出1

2
1
5
0

这个输入包含四个测试用例。

第二行和第三行对应于第一个测试用例,其中$N = 3, A_1 = 1, A_2 = 2, A_3 = 3$。

我们在$A_1$,$A_2$和$A_3$中有两个奇数,因此第一行应包含$2$。

加入题单

算法标签: