QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#609892 | #5. 在线 O(1) 逆元 | Yyyyazs | 0 | 0ms | 3836kb | C++14 | 465b | 2024-10-04 14:21:12 | 2024-11-05 22:04:22 |
Judging History
answer
#include "inv.h"
#include <iostream>
using namespace std;
using ll = long long;
ll p = 998244353;
ll multi(ll a,ll b){
return (a % p * (b % p)) % p;
}
ll add(ll a, ll b){
}
void init(int p){
cin >> p;
}
ll qpow(ll a, ll b){
ll ans = 1;
while (b){
if(b & 1)ans = multi(ans,a);
b >>= 1;
a = multi(a,a);
}
return ans;
}
int inv(int x){
init(p);
return multi(x,qpow(x,p-2));
}
Details
Pretests
Final Tests
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3816kb
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3752kb
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3820kb
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3832kb
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3836kb