QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#217122 | #5. 在线 O(1) 逆元 | Starrykiller | 30 | 2444ms | 3884kb | C++23 | 308b | 2023-10-16 15:13:27 | 2024-11-05 21:53:55 |
Judging History
answer
#include "inv.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int p;
void init(int mod) {p=mod;}
ll qpow(ll a, ll n) {
ll res=1;
while (n) {
if (n&1) res=res*a%p;
a=a*a%p; n>>=1;
}
return res;
}
int inv(int x) {
ll res=qpow(x,p-2);
return int(res);
}
詳細信息
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 25ms
memory: 3884kb
Test #2:
score: 20
Accepted
time: 2444ms
memory: 3756kb
Test #3:
score: 0
Time Limit Exceeded
Test #4:
score: 0
Time Limit Exceeded
Test #5:
score: 0
Time Limit Exceeded