QOJ.ac

QOJ

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

#10014. 瓶子

统计

一位长生不老的精灵从法师那里得到了 $e + p + w$ 瓶液体。

前 $e$ 瓶是灵药。如果精灵喝下灵药,她将对所有当前及未来的毒素效果免疫。

其余 $p$ 瓶毒药编号为 $1$ 到 $p$,含有不同的毒素。每种毒素都有延迟效应:第 $i$ 瓶毒药的延迟时间为 $t + i - 0.5$ 天。如果精灵喝下了第 $i$ 瓶毒药,且在经过相应的延迟时间后,她一生中从未喝过灵药(无论是在喝下毒药之前还是之后喝下灵药均可),她就会死亡。毒素的作用是独立的:每种毒素的延迟时间不会因为喝下其他毒药而改变。

剩下的 $w$ 瓶是水。如果精灵喝下水,什么都不会发生。

每天早上同一时间,精灵会以相等的概率从剩余的非空瓶子中选择一瓶喝下。如果所有瓶子都已喝完,她将不再进行任何操作。

求精灵在开始喝瓶子后的 $10^{10^{10}}$ 天依然存活的概率。请记住,精灵是长生不老的,除了毒药外,她不会死于任何其他原因。

输入格式

输入的第一行包含四个整数:$e, p, w$ 和 $t$ ($1 \le e, p, w, t \le 10^5$)。

输出格式

可以证明该概率是一个有理数。将其表示为 $p/q$,其中 $p$ 和 $q$ 是互质的整数,并输出整数 $p \cdot q^{-1} \pmod{998\,244\,353}$。你可以假设 $q$ 与 $998\,244\,353$ 互质。

样例

样例输入 1

1 1 2 1

样例输出 1

249561089

样例输入 2

1 1 1 42

样例输出 2

1

样例输入 3

2 2 2 2

样例输出 3

987152750

说明

对于这三个样例,答案的有理数形式分别为:$3/4$,$1/1$ 和 $83/90$。

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.