QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#298938 | #5. 在线 O(1) 逆元 | Untitled_unrevised | Compile Error | / | / | C++14 | 323b | 2024-01-06 16:04:29 | 2024-11-05 21:57:27 |
Judging History
你现在查看的是最新测评结果
- [2024-11-05 21:57:27]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-01-06 16:04:30]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-01-06 16:04:29]
- 提交
answer
#include <vector>
#include "inv.h"
std::vector<int> invmem;
size_t s;
int P;
void init(int p) {
s = ((p - 1) >> 3) + 1;
invmem = std::vector<int>(s);
P = p;
invmem[1] = 1;
}
int inv(int x) {
return (x < s && invmem[x]) ? invmem[x] : (invmem[x] = P - (unsigned long long) (P / x) * inv(P % x) % 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:5:1: error: ‘size_t’ does not name a type 5 | size_t s; | ^~~~~~ answer.code:3:1: note: ‘size_t’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’? 2 | #include "inv.h" +++ |+#include <cstddef> 3 | answer.code: In function ‘void init(int)’: answer.code:9:9: error: ‘s’ was not declared in this scope 9 | s = ((p - 1) >> 3) + 1; | ^ answer.code: In function ‘int inv(int)’: answer.code:16:21: error: ‘s’ was not declared in this scope 16 | return (x < s && invmem[x]) ? invmem[x] : (invmem[x] = P - (unsigned long long) (P / x) * inv(P % x) % P); | ^