QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#819182 | #5. 在线 O(1) 逆元 | HugeMouse | 0 | 0ms | 0kb | C++20 | 235b | 2024-12-18 13:45:45 | 2024-12-18 13:45:48 |
answer
#include "inv.h"
const int n = 1e8;
int res[n + 1];
void init(int p) {
res[1] = 1;
for (int i = 2; i <= n; i++) {
res[i] = 1ll * (p - p / i) * res[p % i] % p;
}
}
int inv(int x) {
return res[x];
}
详细
Pretests
Final Tests
Test #1:
score: 0
Runtime Error
Test #2:
score: 0
Runtime Error
Test #3:
score: 0
Runtime Error
Test #4:
score: 0
Runtime Error
Test #5:
score: 0
Runtime Error