QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#775485 | #5. 在线 O(1) 逆元 | Physics212303 | 0 | 0ms | 0kb | C++17 | 185b | 2024-11-23 16:03:40 | 2024-11-23 16:03:41 |
answer
#include "inv.h"
const int N=1e8;
static int P,a[N+1];
void init(int p){
P=p,a[0]=a[1]=1;
for(int i=2;i<=N;i++)
a[i]=P-1ll*(P/i)*a[P%i]%P;
}
int inv(int x){return a[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