QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#624850 | #5. 在线 O(1) 逆元 | BlackPanda | 0 | 722ms | 394520kb | C++14 | 325b | 2024-10-09 16:43:55 | 2024-11-05 22:04:51 |
Judging History
answer
#include "inv.h"
const int N = 1e8+2;
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 - 1ll * (P / x) * inv(P%x) % P;
}
}
詳細信息
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 722ms
memory: 394520kb
Test #2:
score: 0
Wrong Answer
time: 670ms
memory: 394472kb
Test #3:
score: 0
Wrong Answer
time: 701ms
memory: 394472kb
Test #4:
score: 0
Wrong Answer
time: 720ms
memory: 394408kb
Test #5:
score: 0
Wrong Answer
time: 682ms
memory: 394276kb