QOJ.ac

QOJ

実行時間制限: 5 s メモリ制限: 1024 MB 満点: 40

#5793. 收集卡片

統計

你已经沉迷于最新的集换式卡牌游戏《PokeCraft: The Gathering》了。你已经精通了规则!你组建了平衡的、进攻型的和防守型的卡组!你在互联网论坛上争论各种卡牌的优劣!你参加锦标赛!现在,随着他们刚刚宣布 2010 年即将推出的全新卡牌系列,你决定要收集齐所有的卡牌!幸运的是,你大脑中尚存的一丝理智在思考:这需要花多少钱?

即将推出的卡牌系列中共有 $C$ 种卡牌。这些卡牌将以“补充包”的形式出售,每个补充包包含 $N$ 种不同的卡牌。补充包有许多可能的组合,且其中不会有重复的卡牌。当你购买一个补充包时,你将以相等的概率获得所有可能的组合之一。你逐个购买补充包,直到你拥有全部 $C$ 种卡牌。请问你平均需要购买多少个补充包?

输入格式

输入的第一行包含测试用例的数量 $T$。接下来是 $T$ 个测试用例,每个测试用例包含一行,其中包含 $C$ 和 $N$。

输出格式

对于每个测试用例,输出一行格式如下:

Case #x: E

其中 $x$ 是测试用例编号(从 1 开始),$E$ 是你需要购买的补充包的期望数量。任何相对或绝对误差不超过 $10^{-5}$ 的答案都将被接受。

样例

输入格式 1

2
2 1
3 2

输出格式 1

Case #1: 3.0000000
Case #2: 2.5000000

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.