No.2996 Floor Sum
レベル :
/ AI推定難易度 : 2700
/ 実行時間制限 : 1ケース 5.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 12
作問者 :
testestest
/ テスター :
👑
p-adic
タグ : / 解いたユーザー数 12
作問者 :
testestest
/ テスター :
👑
問題文最終更新日: 2024-12-20 16:42:20
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
Advent Calendar Contest 2024
(順位表)
の他の問題:
Problem Statement
Given $p,q,N,M,A,B$, find $\displaystyle \sum_{i=0}^{N}i^p\left\lfloor\frac{Ai+B}{M}\right\rfloor^q$ modulo $998244353$.
Answer $T$ test cases.
Input
$T$ $p_1$ $q_1$ $N_1$ $M_1$ $A_1$ $B_1$ $\dots$ $p_T$ $q_T$ $N_T$ $M_T$ $A_T$ $B_T$
One of the following two types of constraints is satisfied.
- case 1
- $1\leq T\leq 5000$
- $0\leq p,q\leq 2$
- $0\leq N \leq 10^9$
- $1\leq M \leq 10^9$
- $-10^9\leq A,B \leq 10^9$
- case 2
- $1\leq T\leq 5$
- $0\leq p,q\leq 10$
- $0\leq N \leq 10^9$
- $1\leq M \leq 10^9$
- $-10^9\leq A,B \leq 10^9$
Output
On the $i$-th line, print the answer to the $i$-th test case.
Sample
Sample 1
Input
3 1 0 5 6 -2 9 0 1 5 6 -2 9 1 1 5 6 -2 9
Output
15 1 998244349
The answer to the 1st test case is $0+1+2+3+4+5=15$.
The answer to the 2nd test case is $1+1+0+0+0+(-1)=1$.
The answer to the 3rd test case is $0+1+0+0+0+(-5)=-4$. Print the remainder when divided by $998244353$.
Sample 2
Input
2 10 9 123456789 987654321 299792458 -141421356 9 10 987654321 123456789 -998244353 -17320508
Output
914197657 394466986
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。