A. 寻找倍数

    Type: Default 1000ms 256MiB

寻找倍数

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

小杨有一个包含 nn 个正整数的序列 A=[a1,a2,,an]A=[a_1,a_2,\dots,a_n],他想知道是否存在 i(1in)i(1\leq i\leq n) 使得 aia_i 是序列 AA 中所有数的倍数。

输入格式

第一行包含一个正整数 tt,代表测试用例组数。

接下来是 tt 组测试用例。对于每组测试用例,一共两行。

其中,第一行包含一个正整数 nn;第二行包含 nn 个正整数,代表序列 AA

输出格式

对于每组测试用例,如果存在 i(1in)i(1\leq i\leq n) ,满足对于所有 k(1kn)k(1\leq k\leq n) aia_iaka_k 的倍数,输出 Yes,否则输出 No

样例输入 #1

2
3
1 2 4
5
1 2 3 4 5

样例输出 #1

Yes
No

说明

【样例解释】

对于第⼀组数据,对于 a3=4a_3=4,满足 a3a_3a1a_1a2a_2 的倍数。

【数据范围】

对于全部数据,保证有 1t101\leq t\leq 101n1051\leq n\leq 10^51ai1091\leq a_i\leq 10^9

来源

2024 年 6 月 GESP C++ 等级考试。

2024.08.16 入门组周赛

Not Attended
Status
Done
Rule
IOI
Problem
4
Start at
2024-8-16 19:45
End at
2024-8-20 23:45
Duration
100 hour(s)
Host
Partic.
5