QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#489194 | #5. 在线 O(1) 逆元 | qwef_ | 0 | 996ms | 515600kb | C++23 | 467b | 2024-07-24 18:52:58 | 2024-11-05 22:02:33 |
Judging History
answer
//#include <bits/stdc++.h>
#include "inv.h"
typedef long long ll;
const int N=1.31e8+114,p=998244353;
int a[N];
inline void add(int& a,int b){a=(a+b>=p?a+b-p:a+b);}
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,add(j,x))
if(j<N)
return (ll)inv[j]*i%p;
}
//int main(){
// init(998244353);
// int x;
// std::cin >> x;
// std::cout << query(x) << std::endl;
// return 0;
//}
详细
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 996ms
memory: 515520kb
Test #2:
score: 0
Wrong Answer
time: 972ms
memory: 515600kb
Test #3:
score: 0
Wrong Answer
time: 962ms
memory: 515584kb
Test #4:
score: 0
Wrong Answer
time: 975ms
memory: 515600kb
Test #5:
score: 0
Wrong Answer
time: 972ms
memory: 515468kb