CF1771C.Hossam and Trainees
普及/提高-
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Hossam has n trainees. He assigned a number ai for the i-th trainee.
A pair of the i-th and j-th (i=j) trainees is called successful if there is an integer x (x≥2), such that x divides ai, and x divides aj.
Hossam wants to know if there is a successful pair of trainees.
Hossam is very tired now, so he asks you for your help!
侯萨姆有 n 名学员。他为第 i 名学员分配了一个数 ai。
若存在一个整数 x(x≥2),使得 x 同时整除 ai 和 aj,则称第 i 名与第 j 名(i=j)学员组成的对为成功对。
侯萨姆想知道是否存在一个成功对。
侯萨姆现在非常疲惫,因此请你帮忙!
输入格式
The input consists of multiple test cases. The first line contains a single integer t (1≤t≤105), the number of test cases. A description of the test cases follows.
The first line of each test case contains an integer number n (2≤n≤105).
The second line of each test case contains n integers, the number of each trainee a1,a2,…,an (1≤ai≤109).
It is guaranteed that the sum of n over all test cases does not exceed 105.
输入包含多个测试用例。第一行包含一个整数 t(1≤t≤105),表示测试用例的数量。随后是各测试用例的描述。
每个测试用例的第一行包含一个整数 n(2≤n≤105)。
每个测试用例的第二行包含 n 个整数,表示每位学员的编号 a1,a2,…,an(1≤ai≤109)。
保证所有测试用例的 n 之和不超过 105。
输出格式
Print the answer — "YES" (without quotes) if there is a successful pair of trainees and "NO" otherwise. You can print each letter in any case.
输出答案——如果存在一对成功的实习生,则输出 “YES”(不带引号);否则输出 “NO”。每个字母的大小写均可。
输入输出样例
输入#1
2 3 32 48 7 3 14 5 9
输出#1
YES NO
说明/提示
In the first example, the first trainee and the second trainee make up a successful pair:
a1=32,a2=48, you can choose x=4.
在第一个例子中,第一名实习生和第二名实习生组成了一对成功的组合:
a1=32,a2=48,你可以选择 x=4。
输入解题思路,AI测评打分。不知道怎么写?