QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#624738 | #5. 在线 O(1) 逆元 | dww_1337 | 0 | 0ms | 0kb | C++14 | 235b | 2024-10-09 16:32:15 | 2024-10-09 16:32:18 |
Judging History
answer
#include "inv.h"
const int MAXN = 1e8 + 7;
int invt[MAXN];
void init(int p)
{
invt[1] = 1;
for(int i = 2 ; i < MAXN - 2 ; i++) invt[i] = (long long)(p - p / i) * invt[p % i] % p;
}
int inv(int x)
{
return invt[x];
}
Details
Pretests
Final Tests
Test #1:
score: 0
Runtime Error
Test #2:
score: 0
Runtime Error
Test #3:
score: 0
Runtime Error