QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#850092 | #5. 在线 O(1) 逆元 | mnbvcxz123 | 0 | 0ms | 0kb | C++23 | 366b | 2025-01-09 20:17:37 | 2025-01-09 20:17:38 |
answer
#include"inv.h"
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int mod=998244353;
ll inver[1000005];
int xd(int a) {
if(a<=1e6 and inver[a])return inver[a];
return a <= 1 ? a : inver[a]=mod - (long long)(mod/a) * xd(mod % a) % mod;
}
void init(int p){
inver[1]=1;
}
int inv(int x){
return xd(x);
}
Details
Pretests
Final Tests
Test #1:
score: 0
Runtime Error
Test #2:
score: 0
Runtime Error
Test #3:
score: 0
Runtime Error
Test #4:
score: 0
Runtime Error
Test #5:
score: 0
Runtime Error