QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#534319 | #5. 在线 O(1) 逆元 | surgutti | 0 | 0ms | 0kb | C++14 | 238b | 2024-08-27 02:06:32 | 2024-11-05 22:03:15 |
Judging History
answer
#include "inv.h"
const int N = 100000000 + 1;
int inverse[N];
void init(int p) {
inverse[1] = 1;
for (int i = 2; i < N; i++)
inverse[i] = (p - p / i * inverse[p % i] % p) % p;
}
int inv(int x) {
return inverse[x];
}
Details
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