QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#640621 | #5. 在线 O(1) 逆元 | Yu_mx | 30 | 2201ms | 3880kb | C++14 | 221b | 2024-10-14 14:49:39 | 2024-11-05 22:05:21 |
Judging History
answer
#include"inv.h"
int mod;
void init(int p){
mod = p;
}
int inv(int x){
int p = mod;
int k = p-2;
int res = 1%p;
while(k){
if(k&1) res = 1LL*res*x%p;
k >>= 1;
x = 1LL*x*x%p;
}
return res;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 22ms
memory: 3732kb
Test #2:
score: 20
Accepted
time: 2201ms
memory: 3880kb
Test #3:
score: 0
Time Limit Exceeded
Test #4:
score: 0
Time Limit Exceeded
Test #5:
score: 0
Time Limit Exceeded