QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#815710 | #5. 在线 O(1) 逆元 | _tqx | 0 | 0ms | 3884kb | C++17 | 240b | 2024-12-15 16:39:36 | 2024-12-15 16:39:38 |
answer
#include<utility>
#include"inv.h"
int p0;
void init(int p){p0=p;}
std::pair<int,int>exgcd(int a,int b){
if(!b)return{1,0};
auto[x,y]=exgcd(b,a%b);
return{y,x-a/b*y};
}
int inv(int x){
auto[i,_]=exgcd(x,p0);
return i;
}
详细
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3880kb
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3880kb
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3884kb
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3752kb
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3724kb