#K74077. Count Perfect Squares

    ID: 34117 Type: Default 1000ms 256MiB

Count Perfect Squares

Count Perfect Squares

You are given several test cases. In each test case, you are provided with a sequence of non-negative integers. Your task is to count how many numbers in each sequence are perfect squares.

A number n is a perfect square if there exists an integer k such that \(k^2 = n\). For example, 0, 1, 4, 9, 16, ... are perfect squares.

The input begins with an integer representing the number of test cases, followed by that many lines. Each line consists of a list of space-separated non-negative integers. For each test case, output the count of perfect squares, with each answer printed on its own line.

inputFormat

The input is read from standard input (stdin) and has the following format:

T
sequence1
sequence2
... 
sequenceT

Where:

  • T is an integer representing the number of test cases.
  • Each sequence is a space-separated list of non-negative integers.

outputFormat

For each test case, print a single integer on a new line that represents the count of perfect squares in the sequence.

## sample
3
0 1 2 3 4 5 6
9 10 11 15 16 20 25
2 3 5 7 8 10
3

3 0

</p>