QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#865892 | #5. 在线 O(1) 逆元 | snpmrnhlol | Compile Error | / | / | C++17 | 317b | 2025-01-22 05:49:52 | 2025-01-22 05:49:52 |
Judging History
answer
#include <bits/stdc++.h>
#include "inv.h"
using namespace std;
int p2;
int fastexp(int a, int b){
int r = 1;
while(b){
if(b&1)r = 1ll*r*a%p2;
a = 1ll*a*a%p2;
b/=2;
}
return r;
}
void init(int p){
p2 = p;
}
int inv(int x){
return fastexp(x, mod - 2);
}
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: In function ‘int inv(int)’: answer.code:18:23: error: ‘mod’ was not declared in this scope; did you mean ‘modf’? 18 | return fastexp(x, mod - 2); | ^~~ | modf