当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7137:Contest Remake

题目描述
The annual Chengdu Children Poker Contest (CCPC) has begun! Unfortunately, the cards have been all blown away during the contest and the contest cannot go ahead. You, as the contest organizer, need to prepare a rematch and reproduce a pack of cards for the rematch.

The cards used in the contest are quite special — each card represents a set of integers. For a pack of $m$ cards, we denote the set represented by each card as $S_1,S_2,\dots,S_m$. The pack of the cards should meet the following conditions:

- The elements in each set are unordered and distinct.
- For every $i$, $S_i \subset \mathbb{Z}^+$ (the set of all positive integers), and $S_i \neq \emptyset$.
- For every $1 \le i \lt j \le m$, $S_i \neq S_j$.
- For every $i$, $\prod_{x \in S_i}x \le C$, where $C$ is a given constant.

What's more, a mystery guy tells you the reason why the cards are blown away is that you use some ominous integers. There are $n$ ominous integers, and you should avoid using them in case your cards get blown away again. We denote the set of ominous integers as $T$. That is:

- For every $i$, $S_i \cap T=\emptyset$.

You want to reproduce as many cards as possible. Now given $C$ and the $n$ ominous integers, please calculate the maximum number of cards in the pack.
输入解释
The first line contains a positive integer $T$ $(1\le T \le 20)$, indicating the number of test cases.

For each test case, the first line contains two integers $n, C$ $(0\le n\le 10^{5},1\le C \le 10^{9})$, indicating the number of ominous integers and the given constant.

The second line contains $n$ positive integers $a_1,a_2,\dots,a_n$ $(1\le a_i \le C)$, indicating the ominous integers. It is guaranteed that all the $n$ integers are distinct.

It is guaranteed that $\sum n\le 7\times 10^5$, and there are at most $10$ test cases that meet $C>10^6$.
输出解释
For each test case, print one integer in a single line, indicating the maximum number of cards in the pack.
输入样例
2
1 6
3
2 10
3 5
输出样例
9
17

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7137

最后修改于 2021-10-23T19:11:41+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
16000/8000MS(Java/Others) 524288/524288K(Java/Others)