QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#102596 | #5. 在线 O(1) 逆元 | liuzhenhao09 | 80 | 5156ms | 394504kb | C++20 | 343b | 2023-05-03 14:55:32 | 2024-11-05 21:49:22 |
Judging History
answer
#include<bits/stdc++.h>
#include "inv.h"
using namespace std;
const int MOD = 998244353;
int iv[100000010];
int inv(int x){
if(x <= 100000000) return iv[x];
return 1LL * inv(MOD % x) * (MOD - MOD / x) % MOD;
}
void init(int p){
iv[1] = 1;
for(int i = 2; i <= 100000000; i++) iv[i] = 1LL * (MOD - MOD / i) * iv[MOD % i] % MOD;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 868ms
memory: 394504kb
Test #2:
score: 20
Accepted
time: 1435ms
memory: 394504kb
Test #3:
score: 30
Accepted
time: 3583ms
memory: 394504kb
Test #4:
score: 20
Accepted
time: 5156ms
memory: 394316kb
Test #5:
score: 0
Time Limit Exceeded