QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 1024 MB 總分: 100 可 Hack ✓

#10729. 资费困境

统计

Prof. Chen 正在竞选 Pigeland 的总统,并提出了一项可能为国家带来巨额利润的关税策略。

对于一个由 $n$ 个国家组成的贸易路线,所有关税最初均为 $0\%$。每当第 $i$ 个国家提高关税时,关税会增加 $l_i\%$。如果第 $i$ 个国家提高了 $t_i$ 次关税,则关税变为 $\frac{l_i \cdot t_i}{100}$,这意味着价格为 $x$ 的商品经过该国后将变为 $\left(1 + \frac{l_i \cdot t_i}{100}\right) \cdot x$。

Prof. Chen 计划总共提高 $k$ 次关税,这些次数可以任意分配给任何国家。你的任务是帮助 Prof. Chen 确定在最优分配这 $k$ 次关税后,一件商品依次经过所有 $n$ 个国家后的最大可能价格乘数。

输入格式

输入包含多个测试用例。第一行包含一个整数 $T$ ($1 \le T \le 5000$),表示测试用例的数量。

对于每个测试用例,第一行包含两个整数 $n, k$ ($1 \le n \le 40, 1 \le k \le 10^6$),分别表示国家数量和关税提高的总次数。

接下来一行包含 $n$ 个整数。第 $i$ 个整数 $l_i$ ($1 \le l_i \le 100$) 表示第 $i$ 个国家的关税增长率,即 $l_i\%$。

注意:对 $n$ 的总和以及 $k$ 的总和没有额外限制。

输出格式

输出一个实数,表示答案。

如果你的答案与标准答案的绝对误差或相对误差不超过 $10^{-4}$,则视为正确。形式化地,设你的答案为 $a$,标准答案为 $b$,若满足 $\frac{|a-b|}{\max(1, |b|)} \le 10^{-4}$,则你的答案被视为正确。

样例

输入 1

2
3 5
50 100 50
10 1000000
1 2 3 4 5 6 7 8 9 10

输出 1

9
3.63944265968e+36

说明

对于第一个测试用例,关税提高次数的最优分配为 $2, 2, 1$。三个国家的关税分别变为 $100\%, 200\%, 50\%$,因此最终答案为 $2 \cdot 3 \cdot 1.5 = 9$。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.