QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#567279 | #5. 在线 O(1) 逆元 | hly | 0 | 0ms | 3876kb | C++14 | 293b | 2024-09-16 10:46:11 | 2024-11-05 22:03:55 |
Judging History
answer
int prime;
void init(int p)
{
prime=p;
}
int inv(int x)
{
int s1=1,s2=0;
int t1=0,t2=1;
int a=x,b=prime;
int q;
while(b!=0)
{
q=a/b;
int c=a;
a=b;
b=c-a*q;
int s3=s2;
s2=-1*q*s3+s1;
s1=s3;
int t3=t2;
t2=-1*q*t3+t1;
t1=t3;
}
return s2;
}
Details
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3876kb
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3688kb
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3608kb
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3828kb