QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 2048 MB مجموع النقاط: 100

#2303. 幸运衬衫

الإحصائيات

你是一位忙碌的程序设计竞赛选手,通过参加各种编程竞赛收集了大量的 T 恤。事实上,你的 T 恤多到只穿这些衣服了。你把它们整齐地叠放在超大衣柜里的一个大堆中。每天早上,你都会从堆顶拿一件 T 恤穿。一天结束时,你会把这件 T 恤扔进洗衣篮。

Stack of clothes via pxfuel.com

为了保证有干净的 T 恤穿,你有时会在晚上洗衣服,把洗衣篮里的所有 T 恤(包括当天穿的那件)都洗干净。但这并不是按照某种固定的时间表进行的;两次洗涤周期之间的天数是一个在 $1$(此时你只洗一件 T 恤)到你拥有的 T 恤总数之间的均匀随机整数。洗完衣服后,你会以均匀随机的顺序将它们放回堆顶。

现在是一场成功的编程竞赛结束后的晚上,你决定把你刚得到的那件 T 恤作为你的幸运衫。你想知道什么时候能再次穿上它,并沉浸在穿上它后会带来好运的遐想中。你刚刚洗完衣服,并把所有 T 恤放回了堆里。已知你的幸运衫目前在堆中的位置,求经过 $k$ 次洗涤周期后,你的幸运衫的期望位置是多少?

输入格式

输入包含一行,包含三个整数 $n$ ($1 \le n \le 10^6$),表示你拥有的 T 恤总数;$i$ ($1 \le i \le n$),表示你的幸运衫从堆顶开始数的位置;以及 $k$ ($1 \le k \le 10^6$),表示洗涤周期的次数。

输出格式

输出经过 $k$ 次洗涤周期后,你的幸运衫的期望位置。你的答案应具有不超过 $10^{-6}$ 的绝对或相对误差。

样例

输入格式 1

3 2 2

输出格式 1

1.833333333

输入格式 2

5 1 1

输出格式 2

2.0

输入格式 3

10 7 100

输出格式 3

5.499986719

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.