CF2222A.A Wonderful Contest

入门

通过率:0%

AC君温馨提醒

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

题目描述

Nanatsukaze - Save Our Sound

As a person who loves competitions, you now need to participate in a wonderful OI contest.

This contest has $ n $ problems, each with a full score of $ 100 $ . The $ i $ -th problem has $ a_i $ subtasks, and each subtask has a score of $ \frac{100}{a_i} $ . It is guaranteed that $ a_i $ is a divisor of $ 100 $ .

Now, several contestants will participate in this contest. Suppose a contestant solves $ x_i $ ( $ 0\le x_i\le a_i $ ) subtasks of the $ i $ -th problem; his score on the $ i $ -th problem will be $ x_i \cdot \frac{100}{a_i} $ . The total score of the contestant in the contest is the sum of the scores on all problems, i.e., $ \sum\limits_{i=1}^{n} x_i \cdot \frac{100}{a_i} $ .

To prove that the contest is a truly wonderful one, you have to check whether it is possible to achieve every integer total score from $ 0 $ to $ 100\cdot n $ (inclusive). Formally, you have to determine whether the following statement holds:

  • For every integer $ k $ where $ 0\le k\le 100\cdot n $ , there exists an array $ x $ of length $ n $ ( $ 0\le x_i\le a_i $ ) such that $ k=\sum\limits_{i=1}^{n} x_i \cdot \frac{100}{a_i} $ .

输入格式

Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 100 $ ). The description of the test cases follows.

The first line of each test case contains a single integer $ n $ ( $ 1 \le n \le 10 $ ) — the number of problems in the contest.

The second line contains $ n $ integers $ a_1, a_2, \ldots, a_n $ ( $ 1 \le a_i \le 100 $ ) — the number of subtasks of each problem. It is guaranteed that every $ a_i $ is a divisor of $ 100 $ .

输出格式

For each test case, output "Yes" if it is possible to obtain an arbitrary total score between $ 0 $ and $ 100\cdot n $ ; otherwise, output "No".

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

输入输出样例

  • 输入#1

    5
    2
    100 20
    2
    10 10
    3
    50 100 25
    4
    1 2 5 20
    10
    100 1 2 4 5 10 20 25 50 100

    输出#1

    Yes
    No
    Yes
    No
    Yes

说明/提示

In the first test case, for every integer $ k $ ( $ 0 \leq k \leq 200 $ ), it is possible to achieve a total score of exactly $ k $ . For example, when $ k=10 $ , a contestant who passes $ 0 $ subtasks in the first problem and $ 2 $ subtasks in the second problem achieves a total score of $ 0 \cdot \frac{100}{100} + 2 \cdot \frac{100}{20} = 10 $ .

In the second test case, when $ k=95 $ , it can be proven that it is impossible to achieve a total score of exactly $ 95 $ .

In the third test case, for every integer $ k $ ( $ 0 \leq k \leq 300 $ ), it is possible to achieve a total score of exactly $ k $ . For example, when $ k=233 $ , a contestant who passes $ 25 $ , $ 83 $ , and $ 25 $ subtasks in the three problems, respectively, achieves a total score of $ 25 \cdot \frac{100}{50} + 83 \cdot \frac{100}{100} + 25 \cdot \frac{100}{25} = 233 $ .

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

首页