QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#624800 | #5. 在线 O(1) 逆元 | BlackPanda | Compile Error | / | / | C++14 | 225b | 2024-10-09 16:39:00 | 2024-11-05 22:04:46 |
Judging History
你现在查看的是最新测评结果
- [2024-11-05 22:04:46]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-10-09 16:39:06]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-10-09 16:39:00]
- 提交
answer
#include "inv.h"
const int N = 1e8 + 5;
int inv[N];
void init(int p)
{
inv[1] = 1;
for (int i = 2; i <= N - 5; i ++ )
{
inv[i] = (p - p / i) * inv[p % i] % p;
}
}
int inv(int x)
{
return inv[x];
}
Details
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:10: error: ‘int inv [100000005]’ redeclared as different kind of entity 5 | int inv[N]; | ^ In file included from answer.code:1: inv.h:2:5: note: previous declaration ‘int inv(int)’ 2 | int inv(int n); | ^~~ answer.code: In function ‘void init(int)’: answer.code:9:14: warning: pointer to a function used in arithmetic [-Wpointer-arith] 9 | inv[1] = 1; | ^ answer.code:9:16: error: assignment of read-only location ‘*(inv + 1)’ 9 | inv[1] = 1; | ~~~~~~~^~~ answer.code:12:22: warning: pointer to a function used in arithmetic [-Wpointer-arith] 12 | inv[i] = (p - p / i) * inv[p % i] % p; | ^ answer.code:12:49: warning: pointer to a function used in arithmetic [-Wpointer-arith] 12 | inv[i] = (p - p / i) * inv[p % i] % p; | ^ answer.code:12:38: error: invalid operands of types ‘int’ and ‘int(int)’ to binary ‘operator*’ 12 | inv[i] = (p - p / i) * inv[p % i] % p; | ~~~~~~~~~~~ ^ ~~~~~~~~~~ | | | | int int(int) answer.code: In function ‘int inv(int)’: answer.code:18:21: warning: pointer to a function used in arithmetic [-Wpointer-arith] 18 | return inv[x]; | ^ answer.code:18:21: error: invalid conversion from ‘int (*)(int)’ to ‘int’ [-fpermissive] 18 | return inv[x]; | ^ | | | int (*)(int)