QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#714072 | #5. 在线 O(1) 逆元 | lgx57 | 70 ✓ | 655ms | 42972kb | C++14 | 286b | 2024-11-05 21:33:35 | 2024-11-05 21:33:40 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int N=10000000;
int I[N];
void init(int p){
I[1]=1;
for (int i=2;i<N;i++) I[i]=mod-1ll*(mod/i)*I[mod%i]%mod;
}
int inv(int x){
if (x<N) return I[x];
else return mod-1ll*(mod/x)*inv(mod%x)%mod;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 30
Accepted
time: 58ms
memory: 42972kb
Test #2:
score: 40
Accepted
time: 655ms
memory: 42848kb
Test #3:
score: 0
Time Limit Exceeded