QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#705440 | #5. 在线 O(1) 逆元 | lvliang | Compile Error | / | / | C++14 | 555b | 2024-11-02 23:29:08 | 2024-11-05 22:07:59 |
Judging History
你现在查看的是最新测评结果
- [2024-11-05 22:07:59]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-02 23:29:10]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-02 23:29:08]
- 提交
answer
#include "inv.h"
#include <vector>
#include <iostream>
const int N = 1e7 + 10;
vector<int> vec(N);
int quickPow(int base, int power, int mod) {
int result = 1;
base = base % mod;
while (power > 0) {
if (power & 1) {
result = (result * base) % mod;
}
base = (base * base) % mod;
power >>= 1;
}
return result;
}
void init(int p) {
vec[1] = 1;
for (int i = 2; i < N; i++) {
vec[i] = quickPow(i, p - 2, p);
}
}
int inv(int x) {
return vec[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:1: error: ‘vector’ does not name a type 5 | vector<int> vec(N); | ^~~~~~ answer.code: In function ‘void init(int)’: answer.code:19:5: error: ‘vec’ was not declared in this scope 19 | vec[1] = 1; | ^~~ answer.code: In function ‘int inv(int)’: answer.code:26:12: error: ‘vec’ was not declared in this scope 26 | return vec[x]; | ^~~