#P6826. 「EZEC-4」月下轻花舞
「EZEC-4」月下轻花舞
Background
The light flowers under the moon, dancing with the gentle breeze, bring back memories of you and me......

Problem Description
In the Light-Flower Forest, there are light-flower trees numbered from to . For the tree numbered , there are such trees. The Light-Flower Forest is very beautiful, so each tree has light flowers numbered . If the light flower numbered on the tree numbered falls, it produces a charm value of .
When night falls, all light flowers on all trees fall. The "flower fan" (just kidding) tlx wants to know the total charm value, but calculating it only once is too easy, so he will set up different scenarios and ask you times. Since the answer is very large, you only need to output the total charm value modulo .
One-sentence statement: There are queries. Each time you are given three integers , and you need to compute the value of the following expression:
$$\sum_{i=l}^r(i-1)\sum_{j=1}^n \left\lceil\log_ij\right\rceil\;\;\bmod998244353$$Input Format
The first line contains an integer , representing the number of queries.
The next lines each contain three integers , representing the starting tree index, the ending tree index, and the number of light flowers on each tree.
Output Format
Output lines. Each line contains one integer, representing the result of each query modulo .
1
2 3 5
20
2
23333 23333 233233
114514 19260817 1919810
356712294
125194507
Hint
Constraints
This problem uses bundled testdata. The specific constraints are as follows:
- Subtask 1 : , .
- Subtask 2 : .
- Subtask 3 : , , .
- Subtask 4 : .
- Subtask 5 : , .
- Subtask 6 : , .
- Subtask 7 : .
- Subtask 8 : No special restrictions, time limit .
For all testdata, it holds that:
, , .
Note: Any constraints not mentioned in the subtasks use the maximum constraints.
Sample Explanation #1
$$\left\lceil\log_21\right\rceil+\left\lceil\log_22\right\rceil+\left\lceil\log_23\right\rceil+\left\lceil\log_24\right\rceil+\left\lceil\log_25\right\rceil=8$$$$\left\lceil\log_31\right\rceil+\left\lceil\log_32\right\rceil+\left\lceil\log_33\right\rceil+\left\lceil\log_34\right\rceil+\left\lceil\log_35\right\rceil=6$$Therefore:
For Sample #2, I believe your smart brain can get the answer in no time.
Other Hints
If you do not understand logarithm () operations, you can check here.
Translated by ChatGPT 5