QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#671510 | #5. 在线 O(1) 逆元 | QSteve_Paul | Compile Error | / | / | C++23 | 692b | 2024-10-24 13:03:48 | 2024-10-24 13:03:50 |
Judging History
你现在查看的是测评时间为 2024-10-24 13:03:50 的历史记录
- [2024-11-05 22:06:48]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-10-24 13:03:50]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-10-24 13:03:48]
- 提交
answer
#include <inv.h>
using i64 = long long;
constexpr int MAXN = 1e8 + 5;
constexpr int P = 998244353;
i64 qpow(i64 a, i64 n)
{
i64 ans = 1;
while (n)
{
if(n & 1)
ans = ans * a % P;
a = a * a % P;
n >>= 1;
}
return ans;
}
i64 inv(i64 a)
{
return qpow(a, P - 2);
}
int fac[MAXN];
int invfac[MAXN];
void init(int p)
{
fac[0] = 1;
for (i64 i = 1; i <= 1e8; i++)
fac[i] = fac[i] * i % P;
invfac[(int)1e8] = inv(fac[(int)1e8]);
for (i64 i = 1e8 - 1; i >= 0; i--)
invfac[i] = invfac[i + 1] * (i + 1) % P;
}
int inv(int x)
{
return invfac[x] * fac[x - 1] % P;
}
详细
implementer.cpp: In function ‘int main()’: implementer.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ answer.code:1:10: fatal error: inv.h: No such file or directory 1 | #include <inv.h> | ^~~~~~~ compilation terminated.