QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#489114 | #5. 在线 O(1) 逆元 | qwef_ | 60 | 4082ms | 499908kb | C++14 | 270b | 2024-07-24 18:10:20 | 2024-11-05 22:01:56 |
Judging History
answer
#include "inv.h"
typedef long long ll;
const int N=1.27e8+114,p=998244353;
int a[N];
void init(int _){
a[1]=1;
for(int i=2;i<N;++i) a[i]=(ll)(p-p/i)*a[p%i]%p;
}
int inv(int x){
for(int i=1,j=x;;++i,j=(j+x>=p?j+x-p:j+x))
if(j<N)
return (ll)a[j]*i%p;
}
详细
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 868ms
memory: 499908kb
Test #2:
score: 20
Accepted
time: 1498ms
memory: 499824kb
Test #3:
score: 30
Accepted
time: 4082ms
memory: 499760kb
Test #4:
score: 0
Time Limit Exceeded
Test #5:
score: 0
Time Limit Exceeded