QOJ.ac

QOJ

Time Limit: 10 s Memory Limit: 1024 MB Total points: 100

#5477. 蛋糕装饰

Statistics

你正在订购一个蛋糕来庆祝新年。你需要决定蛋糕上装饰品的数量。可用的装饰品有狗玩偶、猫玩偶、红糖果和蓝糖果。

你希望用这四种物品来装饰蛋糕,并且这四种物品的数量各不相同。你还希望玩偶的总数(狗和猫的数量之和)在一定范围内。

装饰品会增加蛋糕的价格。虽然有些奇怪,但额外费用是这四种装饰品数量的乘积。你希望在预算允许的情况下让蛋糕看起来尽可能华丽。因此,如果可以在不违反预算限制的情况下增加四种物品中的任何一种,你就不会对当前的装饰感到满意。

上述条件总结如下。设 $d, c, r$ 和 $b$ 分别为狗玩偶、猫玩偶、红糖果和蓝糖果的数量。所有这些数字都应该是不同的正整数,并满足给定 $X, L$ 和 $R$ 下的以下条件:

  • $L \le d + c < R$,
  • $d \times c \times r \times b \le X$,
  • $(d + 1) \times c \times r \times b > X$,
  • $d \times (c + 1) \times r \times b > X$,
  • $d \times c \times (r + 1) \times b > X$, 且
  • $d \times c \times r \times (b + 1) > X$.

可能有多组四种装饰品数量的组合满足这些条件。你的任务是找出存在多少种这样的组合。

输入格式

输入包含单个测试用例,格式如下:

$X \ L \ R$

其中,$X, L$ 和 $R$ 是上述条件中出现的整数。它们满足 $1 \le X \le 10^{14}$ 且 $1 \le L < R \le 10^{14}$。

输出格式

输出满足上述条件的四种装饰品数量组合的数量,结果对质数 $998\,244\,353 = 2^{23} \times 7 \times 17 + 1$ 取模。

样例

样例输入 1

24 4 6

样例输出 1

12

样例输入 2

30 5 6

样例输出 2

4

样例输入 3

30 9 20

样例输出 3

0

样例输入 4

100000000000000 1 100000000000000

样例输出 4

288287412

说明

对于样例 2,四种组合 $(d, c, r, b) = (2, 3, 1, 5), (2, 3, 5, 1), (3, 2, 1, 5)$ 和 $(3, 2, 5, 1)$ 满足所有条件。$(d, c, r, b) = (1, 4, 2, 3)$ 不符合条件,因为即使再增加一个猫玩偶,其装饰品的额外费用也不超过 $X = 30$。$(d, c, r, b) = (1, 5, 2, 3)$ 也不符合条件,因为它不满足 $d + c < R = 6$。

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.