#C2313. Count Primes in Test Cases
Count Primes in Test Cases
Count Primes in Test Cases
You are given several test cases. In each test case, you are provided with a list of integers. Your task is to count the number of prime numbers in each test case and output the result. A number \(n\) is considered prime if it satisfies the following condition:
\(n > 1\) and its only divisors are 1 and \(n\) itself.
For example, in the test case with numbers [2, 3, 4, 5, 6], the prime numbers are 2, 3, and 5, so the output should be 3.
inputFormat
The input is given via standard input (stdin). The first line contains an integer \(T\) representing the number of test cases. Each test case follows in two parts on a new line:
- The first number is an integer \(N\) indicating the number of elements in the test case.
- Then \(N\) integers are provided separated by spaces.
For example: 2\n5 2 3 4 5 6\n3 8 9 10
represents 2 test cases. The first test case contains 5 numbers: 2, 3, 4, 5, 6; the second contains 3 numbers: 8, 9, 10.
outputFormat
For each test case, output the number of prime integers found, each on a new line. For the example above, the output would be:
3 0## sample
2
5 2 3 4 5 6
3 8 9 10
3
0
</p>