308407: CF1514A. Perfectly Imperfect Array

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

Description

Perfectly Imperfect Array

题意翻译

#### 题目大意: 给定一个长度为 $n$ 的数组 $a$ ,要求判断是否存在一个非空子序列,它的元素乘积不是一个完全平方数。 注意:子序列的定义: $b$ 是 $a$ 的子序列当且仅当可以通过删去 $a$ 的若干个(可以是 $0$ 个) 元素得到 $b$ 。 #### 输入格式: 第一行一个整数 $t$ ( $1 \le t \le 100$ ) ,表示数据组数。 对于每组数据,第一行为一个整数 $n$ ( $1 \le n \le 100$ ) ,表示序列的长度。 接下来一行为 $n$ 个整数 $a_1$ 到 $a_n$ ,表示序列中的元素。 #### 输出格式: 对于每组数据,如果存在一个非空子序列,它的元素乘积不是一个完全平方数,输出 $YES$ ,否则输出 $NO$ 。

题目描述

Given an array $ a $ of length $ n $ , tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square. A sequence $ b $ is a subsequence of an array $ a $ if $ b $ can be obtained from $ a $ by deleting some (possibly zero) elements.

输入输出格式

输入格式


The first line contains an integer $ t $ ( $ 1 \le t \le 100 $ ) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $ n $ ( $ 1 \le n \le 100 $ ) — the length of the array $ a $ . The second line of each test case contains $ n $ integers $ a_1 $ , $ a_2 $ , $ \ldots $ , $ a_{n} $ ( $ 1 \le a_i \le 10^4 $ ) — the elements of the array $ a $ .

输出格式


If there's a subsequence of $ a $ whose product isn't a perfect square, print "YES". Otherwise, print "NO".

输入输出样例

输入样例 #1

2
3
1 5 4
2
100 10000

输出样例 #1

YES
NO

说明

In the first example, the product of the whole array ( $ 20 $ ) isn't a perfect square. In the second example, all subsequences have a perfect square product.

Input

题意翻译

#### 题目大意: 给定一个长度为 $n$ 的数组 $a$ ,要求判断是否存在一个非空子序列,它的元素乘积不是一个完全平方数。 注意:子序列的定义: $b$ 是 $a$ 的子序列当且仅当可以通过删去 $a$ 的若干个(可以是 $0$ 个) 元素得到 $b$ 。 #### 输入格式: 第一行一个整数 $t$ ( $1 \le t \le 100$ ) ,表示数据组数。 对于每组数据,第一行为一个整数 $n$ ( $1 \le n \le 100$ ) ,表示序列的长度。 接下来一行为 $n$ 个整数 $a_1$ 到 $a_n$ ,表示序列中的元素。 #### 输出格式: 对于每组数据,如果存在一个非空子序列,它的元素乘积不是一个完全平方数,输出 $YES$ ,否则输出 $NO$ 。

加入题单

算法标签: