CF2195A.Sieve of Erato67henes

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given nn positive integers a1,a2,…,ana_1,a_2,\ldots,a_n.

Please determine if it is possible to select any number of elements in aa, so that their product is 6767.

Note that you may not select zero elements, as the product of zero elements is not defined in this problem.

给你 nn 个正整数 a1,a2,…,ana_1,a_2,\ldots,a_n。

请判断是否能从数组 aa 中选出任意多个元素,使得它们的乘积恰好为 6767。

注意:你不能一个元素都不选,因为本题中未定义空集(零个元素)的乘积。

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤1041 \le t \le 10^4). The description of the test cases follows.

The first line of each test case contains a single integer nn (1≤n≤51 \le n \le 5).

The second line of each test case contains nn positive integers a1,a2,…,ana_1,a_2,\ldots,a_n (1≤ai≤671 \le a_i \le 67).

每个测试包含多个测试用例。第一行包含测试用例的数量 tt(1≤t≤1041 \le t \le 10^4)。随后是各测试用例的描述。

每个测试用例的第一行包含一个整数 nn(1≤n≤51 \le n \le 5)。

每个测试用例的第二行包含 nn 个正整数 a1,a2,…,ana_1,a_2,\ldots,a_n(1≤ai≤671 \le a_i \le 67)。

输出格式

If it is possible to select elements so that their product is 6767, output "YES" on one line. Otherwise, output "NO" on one line.

You can output the answer in any case. For example, the strings "yEs", "yes", and "Yes" will also be recognized as positive responses.

如果可以选择若干元素,使得它们的乘积为 6767,则在一行中输出 "YES";否则,在一行中输出 "NO"。

你可以以任意大小写形式输出答案。例如,字符串 "yEs"、"yes" 和 "Yes" 也会被识别为肯定回答。

输入输出样例

  • 输入#1

    2
    5
    1 7 6 7 67
    5
    1 3 5 7 8

    输出#1

    YES
    NO

说明/提示

In the first test case, you can select a1a_1 and a5a_5 to get a1⋅a5=1⋅67=67a_1\cdot a_5 = 1 \cdot 67 = 67.

In the second test case, it is impossible to select any number of elements so that their product is 6767.

在第一个测试用例中,你可以选择 a1a_1 和 a5a_5,得到 a1⋅a5=1⋅67=67a_1\cdot a_5 = 1 \cdot 67 = 67。

在第二个测试用例中,无法选择任意多个元素,使其乘积等于 6767。

输入解题思路,AI测评打分。不知道怎么写?

首页