QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#268028 | #5. 在线 O(1) 逆元 | David713 | 0 | 743ms | 394232kb | C++14 | 403b | 2023-11-27 22:58:01 | 2023-11-27 22:58:03 |
Judging History
answer
#include "inv.h"
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, N = 1e8 + 10;
typedef long long ll;
int invv[N];
void init(int p)
{
invv[0] = invv[1] = 1;
for (int i = 2; i <= 1e8; i++) invv[i] = ll((mod - mod / i) * invv[mod % i]) % mod;
}
int inv(int x)
{
if (x <= 1e8) return invv[x];
return ((ll)(mod - mod / x) * (ll)(inv(mod % x))) % mod;
}
Details
Test #1:
score: 0
Wrong Answer
time: 675ms
memory: 394056kb
Test #2:
score: 0
Wrong Answer
time: 743ms
memory: 394132kb
Test #3:
score: 0
Wrong Answer
time: 712ms
memory: 394232kb