QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#624855 | #5. 在线 O(1) 逆元 | BlackPanda | 0 | 599ms | 394516kb | C++14 | 321b | 2024-10-09 16:45:10 | 2024-11-05 22:04:51 |
Judging History
answer
#include "inv.h"
const int N = 1e8+5;
const int P = 998244353;
int invv[N];
void init(int p)
{
invv[1] = 1;
for (int i = 2; i <= N; i ++ )
{
invv[i] = (p - p / i) * invv[p % i] % p;
}
}
int inv(int x)
{
if(x < N){
return invv[x];
} else {
return (P - P / x) * inv(P % x) % P;
}
}
詳細信息
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 554ms
memory: 394516kb
Test #2:
score: 0
Wrong Answer
time: 560ms
memory: 394400kb
Test #3:
score: 0
Wrong Answer
time: 599ms
memory: 394444kb
Test #4:
score: 0
Wrong Answer
time: 569ms
memory: 394444kb
Test #5:
score: 0
Wrong Answer
time: 571ms
memory: 394448kb